Changeset: 6db860864621 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6db860864621
Added Files:
        sql/test/BugTracker-2015/Tests/negative_oid_crash.Bug-3667.sql
        sql/test/BugTracker-2015/Tests/negative_oid_crash.Bug-3667.stable.err
        sql/test/BugTracker-2015/Tests/negative_oid_crash.Bug-3667.stable.out
Modified Files:
        clients/mapiclient/mclient.c
        monetdb5/modules/mal/joinpath.c
        sql/backends/monet5/UDF/Tests/udf-fuse.stable.out
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_result.c
        sql/backends/monet5/vaults/fits.c
        sql/benchmarks/ssbm/Tests/01-explain.stable.out
        sql/benchmarks/ssbm/Tests/01-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/02-explain.stable.out
        sql/benchmarks/ssbm/Tests/02-explain.stable.out.int128
        sql/benchmarks/ssbm/Tests/03-explain.stable.out
        sql/benchmarks/ssbm/Tests/03-explain.stable.out.int128
        sql/benchmarks/tpch/Tests/06-explain.stable.out
        sql/benchmarks/tpch/Tests/06-explain.stable.out.int128
        sql/benchmarks/tpch/Tests/14-explain.stable.out
        sql/benchmarks/tpch/Tests/14-explain.stable.out.int128
        sql/benchmarks/tpch/Tests/17-explain.stable.out
        sql/benchmarks/tpch/Tests/17-explain.stable.out.int128
        sql/benchmarks/tpch/Tests/19-explain.stable.out
        sql/benchmarks/tpch/Tests/19-explain.stable.out.int128
        sql/common/sql_types.c
        sql/common/sql_types.h
        sql/test/BugTracker-2015/Tests/All
        sql/test/BugTracker/Tests/jdbc_no_debug.SF-1739356.stable.out
Branch: default
Log Message:

Merge with default


diffs (truncated from 375 to 300 lines):

diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -910,7 +910,7 @@ TESTrenderer(MapiHdl hdl)
                        mnstr_printf(toConsole, "%s", sep);
                        sep = ",\t";
                        if (s == NULL)
-                               mnstr_printf(toConsole, mode == SQL ? "NULL" : 
"nil");
+                               mnstr_printf(toConsole, "%s", mode == SQL ? 
"NULL" : "nil");
                        else if (strcmp(tp, "varchar") == 0 ||
                                 strcmp(tp, "char") == 0 ||
                                 strcmp(tp, "clob") == 0 ||
diff --git a/monetdb5/modules/mal/joinpath.c b/monetdb5/modules/mal/joinpath.c
--- a/monetdb5/modules/mal/joinpath.c
+++ b/monetdb5/modules/mal/joinpath.c
@@ -305,7 +305,7 @@ ALGjoinPath(Client cntxt, MalBlkPtr mb, 
                        for( --top; top>=0; top--)
                                BBPunfix(joins[top]->batCacheid);
                        GDKfree(joins);
-                       throw(MAL, "algebra.joinPath", error? 
SEMANTIC_TYPE_MISMATCH: INTERNAL_BAT_ACCESS);
+                       throw(MAL, "algebra.joinPath", "%s", error? 
SEMANTIC_TYPE_MISMATCH: INTERNAL_BAT_ACCESS);
                }
                joins[top++] = b;
        }
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -1289,7 +1289,7 @@ rel2bin_table( mvc *sql, sql_rel *rel, l
                l = sa_list(sql->sa);
                for (argc = 0; argc < sql->argc; argc++) {
                        atom *a = sql->args[argc];
-                       stmt *s = stmt_atom(sql->sa, a);
+                       stmt *s = stmt_varnr(sql->sa, argc, &a->tpe);
                        char nme[16];
 
                        snprintf(nme, 16, "A%d", argc);
diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -1393,7 +1393,7 @@ export_length(stream *s, int mtype, int 
                        }
                        ok = mvc_send_int(s, l);
                }
-       } else if (eclass == EC_NUM) {
+       } else if (eclass == EC_NUM || eclass == EC_POS) {
                count = 0;
                if (bid) {
                        BAT *b = BATdescriptor(bid);
diff --git a/sql/backends/monet5/vaults/fits.c 
b/sql/backends/monet5/vaults/fits.c
--- a/sql/backends/monet5/vaults/fits.c
+++ b/sql/backends/monet5/vaults/fits.c
@@ -227,7 +227,7 @@ str FITSexportTable(Client cntxt, MalBlk
        colname = (str *) GDKmalloc(columns * sizeof(str));
        tform = (str *) GDKmalloc(columns * sizeof(str));
 
-       /*      mnstr_printf(GDKout,"Number of columns: %d\n", columns);*/
+       /*      fprintf(stderr,"Number of columns: %d\n", columns);*/
 
        tables = mvc_bind_table(m, sch, "_tables");
        col = mvc_bind_column(m, tables, "name");
@@ -274,7 +274,7 @@ str FITSexportTable(Client cntxt, MalBlk
        nrows = store_funcs.count_col(tr, col, 1);
 
        snprintf(filename,BUFSIZ,"\n%s.fit",tname);
-       mnstr_printf(GDKout, "Filename: %s\n", filename);
+       fprintf(stderr, "Filename: %s\n", filename);
 
        remove(filename);
 
@@ -529,15 +529,15 @@ str FITSexportTable(Client cntxt, MalBlk
 
        /* print all the times that were needed to export each one of the 
columns
                
-       mnstr_printf(GDKout, "\n\n");
-       if (texportboolean > 0)         mnstr_printf(GDKout, "%d 
Boolean\tcolumn(s) exported in %d ms\n", boolcols,   texportboolean);
-       if (texportchar > 0)            mnstr_printf(GDKout, "%d 
Char\t\tcolumn(s) exported in %d ms\n",    charcols,   texportchar);
-       if (texportstring > 0)          mnstr_printf(GDKout, "%d 
String\tcolumn(s) exported in %d ms\n",  strcols,    texportstring);
-       if (texportshort > 0)           mnstr_printf(GDKout, "%d 
Short\t\tcolumn(s) exported in %d ms\n",   shortcols,  texportshort);
-       if (texportint > 0)             mnstr_printf(GDKout, "%d 
Integer\tcolumn(s) exported in %d ms\n", intcols,    texportint);
-       if (texportlong > 0)            mnstr_printf(GDKout, "%d 
Long\t\tcolumn(s) exported in %d ms\n",    longcols,   texportlong);
-       if (texportfloat > 0)           mnstr_printf(GDKout, "%d 
Float\t\tcolumn(s) exported in %d ms\n",   floatcols,  texportfloat);
-       if (texportdouble > 0)          mnstr_printf(GDKout, "%d 
Double\tcolumn(s) exported in %d ms\n",  doublecols, texportdouble);
+       fprintf(stderr, "\n\n");
+       if (texportboolean > 0)         fprintf(stderr, "%d Boolean\tcolumn(s) 
exported in %d ms\n", boolcols,   texportboolean);
+       if (texportchar > 0)            fprintf(stderr, "%d Char\t\tcolumn(s) 
exported in %d ms\n",    charcols,   texportchar);
+       if (texportstring > 0)          fprintf(stderr, "%d String\tcolumn(s) 
exported in %d ms\n",  strcols,    texportstring);
+       if (texportshort > 0)           fprintf(stderr, "%d Short\t\tcolumn(s) 
exported in %d ms\n",   shortcols,  texportshort);
+       if (texportint > 0)             fprintf(stderr, "%d Integer\tcolumn(s) 
exported in %d ms\n", intcols,    texportint);
+       if (texportlong > 0)            fprintf(stderr, "%d Long\t\tcolumn(s) 
exported in %d ms\n",    longcols,   texportlong);
+       if (texportfloat > 0)           fprintf(stderr, "%d Float\t\tcolumn(s) 
exported in %d ms\n",   floatcols,  texportfloat);
+       if (texportdouble > 0)          fprintf(stderr, "%d Double\tcolumn(s) 
exported in %d ms\n",  doublecols, texportdouble);
        */
 
        fits_close_file(fptr, &status);
@@ -597,7 +597,7 @@ str FITSdirpat(Client cntxt, MalBlkPtr m
        snprintf(fulldirectory, BUFSIZ, "%s%s", dir, pat);
        glob(fulldirectory, GLOB_DOOFFS, NULL, &globbuf);
 
-       /*      mnstr_printf(GDKout,"#fulldir: %s \nSize: %lu\n",fulldirectory, 
globbuf.gl_pathc);*/
+       /*      fprintf(stderr,"#fulldir: %s \nSize: %lu\n",fulldirectory, 
globbuf.gl_pathc);*/
 
        if (globbuf.gl_pathc == 0)
                throw(MAL, "listdir", "Couldn't open the directory or there are 
no files that match the pattern");
@@ -902,14 +902,14 @@ str FITSloadTable(Client cntxt, MalBlkPt
                fits_get_coltype(fptr, j, &tpcode[j - 1], &rep[j - 1], &wid[j - 
1], &status);
                fits2subtype(&tpe, tpcode[j - 1], rep[j - 1], wid[j - 1]);
 
-               /*              mnstr_printf(cntxt->fdout,"#%d %ld %ld - M: 
%s\n", tpcode[j-1], rep[j-1], wid[j-1], tpe.type->sqlname); */
+               /*              fprintf(stderr,"#%d %ld %ld - M: %s\n", 
tpcode[j-1], rep[j-1], wid[j-1], tpe.type->sqlname); */
 
                mvc_create_column(m, tbl, cname[j - 1], &tpe);
        }
 
        /* data load */
        fits_get_num_rows(fptr, &rows, &status);
-       mnstr_printf(cntxt->fdout,"#Loading %ld rows in table %s\n", rows, 
tname);
+       fprintf(stderr,"#Loading %ld rows in table %s\n", rows, tname);
        for (j = 1; j <= cnum; j++) {
                BAT *tmp = NULL;
                int time0 = GDKms();
@@ -952,7 +952,7 @@ str FITSloadTable(Client cntxt, MalBlkPt
                        for(i = 0; i < bsize ; i++)
                                GDKfree(v[i]);
                        GDKfree(v);
-                       mnstr_printf(cntxt->fdout,"#String column load %d ms, 
BUNappend %d ms\n", tloadtm, tattachtm);
+                       fprintf(stderr,"#String column load %d ms, BUNappend %d 
ms\n", tloadtm, tattachtm);
                }
 
                if (status) {
@@ -961,9 +961,9 @@ str FITSloadTable(Client cntxt, MalBlkPt
                        msg = createException(MAL, "fits.loadtable", "Cannot 
load column %s of %s table: %s.\n", cname[j - 1], tname, buf);
                        break;
                }
-               mnstr_printf(cntxt->fdout,"#Column %s loaded for %d ms\t", 
cname[j-1], GDKms() - time0);
+               fprintf(stderr,"#Column %s loaded for %d ms\t", cname[j-1], 
GDKms() - time0);
                store_funcs.append_col(m->session->tr, col, tmp, TYPE_bat);
-               mnstr_printf(cntxt->fdout,"#Total %d ms\n", GDKms() - time0);
+               fprintf(stderr,"#Total %d ms\n", GDKms() - time0);
                BBPunfix(tmp->batCacheid);
        }
 
diff --git a/sql/benchmarks/tpch/Tests/06-explain.stable.out 
b/sql/benchmarks/tpch/Tests/06-explain.stable.out
--- a/sql/benchmarks/tpch/Tests/06-explain.stable.out
+++ b/sql/benchmarks/tpch/Tests/06-explain.stable.out
@@ -75,7 +75,7 @@ function user.s2_1{autoCommit=true}(A0:d
     X_55 := sql.projectdelta(X_45,X_14,X_17,r1_17,X_20);
     X_56:bat[:oid,:lng]  := batcalc.*(X_54,X_55);
     X_57:lng  := aggr.sum(X_56);
-    sql.exportValue(1,"sys.L1","revenue","decimal",19,4,8,X_57,"");
+    sql.exportValue(1,"sys.L1","revenue","decimal",19,4,9,X_57,"");
 end s2_1;
 # querylog.define("explain select\n\tsum(l_extendedprice * l_discount) as 
revenue\nfrom\n\tlineitem\nwhere\n\tl_shipdate >= date \\'1994-01-01\\'\n\tand 
l_shipdate < date \\'1994-01-01\\' + interval \\'1\\' year\n\tand l_discount 
between 0.06 - 0.01 and 0.06 + 0.01\n\tand l_quantity < 24;","sequential_pipe")
 
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -101,20 +101,21 @@ int bits2digits(int bits)
 /* 3 casts are allowed (requires dynamic checks) (sofar not used) */
 static int convert_matrix[EC_MAX][EC_MAX] = {
 
-/* EC_ANY */   { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* NULL */
-/* EC_TABLE */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
-/* EC_BIT */   { 0, 0, 1, 1, 1, 0, 2, 2, 2, 0, 0, 0, 0, 0 },
-/* EC_CHAR */  { 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
-/* EC_STRING */        { 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
-/* EC_BLOB */  { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
-/* EC_NUM */   { 0, 0, 2, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
-/* EC_INTERVAL*/{ 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 0, 0 },
-/* EC_DEC */   { 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0 },
-/* EC_FLT */   { 0, 0, 0, 1, 1, 0, 1, 3, 1, 1, 0, 0, 0, 0 },
-/* EC_TIME */  { 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0 },
-/* EC_DATE */  { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 3, 0 },
-/* EC_TSTAMP */        { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0 },
-/* EC_EXTERNAL*/{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+/* EC_ANY */   { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, /* NULL */
+/* EC_TABLE */ { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+/* EC_BIT */   { 0, 0, 1, 1, 1, 0, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
+/* EC_CHAR */  { 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
+/* EC_STRING */        { 2, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 },
+/* EC_BLOB */  { 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+/* EC_POS */   { 0, 0, 2, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
+/* EC_NUM */   { 0, 0, 2, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
+/* EC_INTERVAL*/{ 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0 },
+/* EC_DEC */   { 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
+/* EC_FLT */   { 0, 0, 0, 1, 1, 0, 1, 1, 3, 1, 1, 0, 0, 0, 0 },
+/* EC_TIME */  { 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0 },
+/* EC_DATE */  { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 3, 0 },
+/* EC_TSTAMP */        { 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0 },
+/* EC_EXTERNAL*/{ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
 };
 
 int sql_type_convert (int from, int to) 
@@ -1145,13 +1146,16 @@ sqltypeinit( sql_allocator *sa)
        *t++ = sql_create_type(sa, "CLOB",    0, 0, 0, EC_STRING, "str");
 
        numerical = t;
+#if SIZEOF_OID == SIZEOF_INT
+       OID = *t++ = sql_create_type(sa, "OID", 31, 0, 2, EC_POS, "oid");
+#endif
+#if SIZEOF_OID == SIZEOF_LNG
+       OID = *t++ = sql_create_type(sa, "OID", 63, 0, 2, EC_POS, "oid");
+#endif
 
        BTE = *t++ = sql_create_type(sa, "TINYINT",   8, SCALE_FIX, 2, EC_NUM, 
"bte");
        SHT = *t++ = sql_create_type(sa, "SMALLINT", 16, SCALE_FIX, 2, EC_NUM, 
"sht");
        INT = *t++ = sql_create_type(sa, "INT",      32, SCALE_FIX, 2, EC_NUM, 
"int");
-#if SIZEOF_OID == SIZEOF_INT
-       OID = *t++ = sql_create_type(sa, "OID", 31, 0, 2, EC_NUM, "oid");
-#endif
 #if SIZEOF_WRD == SIZEOF_INT
        WRD = *t++ = sql_create_type(sa, "WRD", 32, SCALE_FIX, 2, EC_NUM, 
"wrd");
 #endif
@@ -1159,9 +1163,6 @@ sqltypeinit( sql_allocator *sa)
        LargestINT =
 #endif
        LNG = *t++ = sql_create_type(sa, "BIGINT",   64, SCALE_FIX, 2, EC_NUM, 
"lng");
-#if SIZEOF_OID == SIZEOF_LNG
-       OID = *t++ = sql_create_type(sa, "OID", 63, 0, 2, EC_NUM, "oid");
-#endif
 #if SIZEOF_WRD == SIZEOF_LNG
        WRD = *t++ = sql_create_type(sa, "WRD", 64, SCALE_FIX, 2, EC_NUM, 
"wrd");
 #endif
diff --git a/sql/common/sql_types.h b/sql/common/sql_types.h
--- a/sql/common/sql_types.h
+++ b/sql/common/sql_types.h
@@ -27,7 +27,7 @@
 #include <sql_storage.h>
 #include <stream.h>
 
-#define EC_MAX                 14
+#define EC_MAX                 15
 #define EC_ANY         0
 #define EC_TABLE       1
 #define EC_BIT                 2
@@ -36,22 +36,23 @@
 #define EC_BLOB                5
 #define EC_VARCHAR(e)  (e==EC_CHAR||e==EC_STRING)
 
-#define EC_NUM                 6
-#define EC_INTERVAL    7
-#define EC_DEC                 8
-#define EC_FLT                 9
-#define EC_NUMBER(e)   (e==EC_NUM||e==EC_INTERVAL||e==EC_DEC||e==EC_FLT)
+#define EC_POS                 6
+#define EC_NUM                 7
+#define EC_INTERVAL    8
+#define EC_DEC                 9
+#define EC_FLT                 10
+#define EC_NUMBER(e)   
(e==EC_POS||e==EC_NUM||e==EC_INTERVAL||e==EC_DEC||e==EC_FLT)
 
-#define EC_TIME                10
-#define EC_DATE                11
-#define EC_TIMESTAMP   12
+#define EC_TIME                11
+#define EC_DATE                12
+#define EC_TIMESTAMP   13
 #define EC_TEMP(e)     (e==EC_TIME||e==EC_DATE||e==EC_TIMESTAMP)
-#define EC_EXTERNAL    13
+#define EC_EXTERNAL    14
 
 #define EC_TEMP_FRAC(e)        (e==EC_TIME||e==EC_TIMESTAMP)
 
 #define EC_FIXED(e)    (e==EC_BIT||e==EC_CHAR||\
-                        e==EC_NUM||e==EC_INTERVAL||e==EC_DEC||EC_TEMP(e))
+                        
e==EC_POS||e==EC_NUM||e==EC_INTERVAL||e==EC_DEC||EC_TEMP(e))
 
 #define has_tz(e,n)    (EC_TEMP(e) && \
                        ((e == EC_TIME && strcmp(n, "timetz") == 0) || \
diff --git a/sql/test/BugTracker-2015/Tests/All 
b/sql/test/BugTracker-2015/Tests/All
--- a/sql/test/BugTracker-2015/Tests/All
+++ b/sql/test/BugTracker-2015/Tests/All
@@ -8,4 +8,5 @@ inet-ordering.Bug-3660
 row-value-constructor-crash.Bug-3662
 incorrect-ROW_NUMBER.Bug-3663
 string-to-inet.Bug-3666
+negative_oid_crash.Bug-3667
 ukey_check_unaligned.Bug-3669
diff --git a/sql/test/BugTracker-2015/Tests/negative_oid_crash.Bug-3667.sql 
b/sql/test/BugTracker-2015/Tests/negative_oid_crash.Bug-3667.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2015/Tests/negative_oid_crash.Bug-3667.sql
@@ -0,0 +1,4 @@
+CREATE TABLE OID_TBL(f1 oid);
+INSERT INTO OID_TBL(f1) VALUES (-1040);
+SELECT * FROM OID_TBL;
+drop table OID_TBL;
diff --git 
a/sql/test/BugTracker-2015/Tests/negative_oid_crash.Bug-3667.stable.err 
b/sql/test/BugTracker-2015/Tests/negative_oid_crash.Bug-3667.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2015/Tests/negative_oid_crash.Bug-3667.stable.err
@@ -0,0 +1,40 @@
+stderr of test 'negative_oid_crash.Bug-3667` in directory 
'sql/test/BugTracker-2015` itself:
+
+
+# 18:39:12 >  
+# 18:39:12 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=30454" "--set" 
"mapi_usock=/var/tmp/mtest-18114/.s.monetdb.30454" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2015"
 "--set" "mal_listing=0" "--set" "embedded_r=yes"
+# 18:39:12 >  
+
+# builtin opt  gdk_dbpath = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to