Changeset: 6e654e365e4c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6e654e365e4c
Modified Files:
        gdk/gdk.h
        gdk/gdk_analytic.h
        geom/monetdb5/geom.c
        monetdb5/modules/kernel/status.c
        monetdb5/modules/mal/mal_io.c
        sql/backends/monet5/rel_bin.c
        sql/server/sql_mvc.c
        sql/server/sql_scan.c
        sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.sql
        sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.err
        sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.sql
        sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.err
        sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.out
        sql/test/Tests/session_vars.sql
        sql/test/Tests/session_vars.stable.err
        sql/test/Tests/session_vars.stable.out
        sql/test/miscellaneous/Tests/declared_tables.sql
        sql/test/miscellaneous/Tests/declared_tables.stable.err
        sql/test/pg_regress/Tests/timestamp.sql
        sql/test/pg_regress/Tests/timestamptz.sql
        sql/test/ssqq/Tests/insert_query.stable.err
        sql/test/ssqq/Tests/insert_query.stable.out
        sql/test/ssqq/Tests/insert_queue.stable.err
        sql/test/ssqq/Tests/insert_queue.stable.out
        sql/test/ssqq/Tests/insert_quser.stable.err
        sql/test/ssqq/Tests/insert_quser.stable.out
Branch: default
Log Message:

Merged with Jun2020


diffs (truncated from 517 to 300 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1928,10 +1928,6 @@ gdk_export int ALIGNsynced(BAT *b1, BAT 
 
 gdk_export void BATassertProps(BAT *b);
 
-#define BATPROPS_QUICK  0      /* only derive easy (non-resource consuming) 
properties */
-#define BATPROPS_ALL   1       /* derive all possible properties; no matter 
what cost (key=hash) */
-#define BATPROPS_CHECK  3      /* BATPROPS_ALL, but start from scratch and 
report illegally set properties */
-
 gdk_export BAT *VIEWcreate(oid seq, BAT *b);
 gdk_export void VIEWbounds(BAT *b, BAT *view, BUN l, BUN h);
 
diff --git a/gdk/gdk_analytic.h b/gdk/gdk_analytic.h
--- a/gdk/gdk_analytic.h
+++ b/gdk/gdk_analytic.h
@@ -14,8 +14,6 @@
 #ifndef _GDK_ANALYTIC_H_
 #define _GDK_ANALYTIC_H_
 
-#include "gdk.h"
-
 gdk_export gdk_return GDKanalyticaldiff(BAT *r, BAT *b, BAT *p, int tpe);
 
 gdk_export gdk_return GDKanalyticalntile(BAT *r, BAT *b, BAT *p, BAT *n, int 
tpe, const void *restrict ntile);
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -1594,11 +1594,15 @@ dumpGeometriesSingle(BAT *idBAT, BAT *ge
                snprintf(newPath, lvlDigitsNum + 1, "%u", *lvl);
        } else {
                //remove the comma at the end of the path
-               newPath = GDKmalloc(pathLength
 #ifdef STATIC_CODE_ANALYSIS
-                                   + 1
+               /* coverity complains about the allocated space being
+                * too small, but we just want to reduce the length of
+                * the string by one, so the length in the #else part
+                * is exactly what we need */
+               newPath = GDKmalloc(pathLength + 1);
+#else
+               newPath = GDKmalloc(pathLength);
 #endif
-                       );
                if (newPath == NULL) {
                        GDKfree(singleWKB);
                        throw(MAL, "geom.Dump", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
diff --git a/monetdb5/modules/kernel/status.c b/monetdb5/modules/kernel/status.c
--- a/monetdb5/modules/kernel/status.c
+++ b/monetdb5/modules/kernel/status.c
@@ -633,7 +633,7 @@ SYSgdkThread(bat *ret, bat *ret2)
                thr = THRget(i);
                if (ATOMIC_GET(&thr->pid)){
                        if (BUNappend(bn, &thr->tid, false) != GDK_SUCCEED ||
-                               BUNappend(b, thr->name? thr->name:"", false) != 
GDK_SUCCEED)
+                               BUNappend(b, thr->name, false) != GDK_SUCCEED)
                                goto bailout;
                }
        }
diff --git a/monetdb5/modules/mal/mal_io.c b/monetdb5/modules/mal/mal_io.c
--- a/monetdb5/modules/mal/mal_io.c
+++ b/monetdb5/modules/mal/mal_io.c
@@ -550,7 +550,7 @@ IOtable(Client cntxt, MalBlkPtr mb, MalS
        ptr val;
 
        (void) cntxt;
-       if ( pci->retc != 1 || pci->argc < 2)
+       if ( pci->retc != 1 || pci->argc < 2 || pci->argc >= MAXPARAMS)
                throw(MAL, "io.table", "INTERNAL ERROR" " assertion error  retc 
%d  argc %d", pci->retc, pci->argc);
 
        memset(piv, 0, sizeof(BAT*) * MAXPARAMS);
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
@@ -789,12 +789,12 @@ exp_bin(backend *be, sql_exp *e, stmt *l
 
                                as = exp_bin(be, at, left, right, NULL, NULL, 
NULL, sel);
 
-                               if (as && as->nrcols <= 0 && left && 
(a->func->base.name[0] != 'm' || en->next || en == attr->h)) 
+                               if (as && as->nrcols <= 0 && left) 
                                        as = stmt_const(be, 
bin_first_column(be, left), as);
                                if (en == attr->h && !en->next && 
exp_aggr_is_count(e))
                                        as = exp_count_no_nil_arg(e, ext, at, 
as);
                                /* insert single value into a column */
-                               if (as && as->nrcols <= 0 && !left && 
(a->func->base.name[0] != 'm' || en->next || en == attr->h))
+                               if (as && as->nrcols <= 0 && !left)
                                        as = const_column(be, as);
 
                                if (!as)
@@ -858,8 +858,8 @@ exp_bin(backend *be, sql_exp *e, stmt *l
                        node *n;
                        int first = 1;
 
-                       ops = sa_list(sql->sa);
-                       args = e->l;
+                       ops = sa_list(sql->sa);
+                       args = e->l;
                        for( n = args->h; n; n = n->next ) {
                                s = NULL;
                                if (!swapped)
diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c
--- a/sql/server/sql_mvc.c
+++ b/sql/server/sql_mvc.c
@@ -488,7 +488,6 @@ mvc_trans(mvc *m)
                        }
                } else { /* clean all but the prepared statements */
                        qc_clean(m->qc, false);
-                       stack_pop_until(m, NR_GLOBAL_VARS);
                }
        }
        store_unlock();
@@ -611,7 +610,6 @@ mvc_commit(mvc *m, int chain, const char
                if (m->qc) /* clean query cache, protect against concurrent 
access on the hash tables (when functions already exists, concurrent mal will
 build up the hash (not copied in the trans dup)) */
                        qc_clean(m->qc, false);
-               stack_pop_until(m, NR_GLOBAL_VARS);
                m->session->schema = find_sql_schema(m->session->tr, 
m->session->schema_name);
                TRC_INFO(SQL_TRANS, "Savepoint commit '%s' done\n", name);
                return msg;
@@ -708,7 +706,6 @@ mvc_rollback(mvc *m, int chain, const ch
        assert(m->session->tr && m->session->tr->active);       /* only abort 
an active transaction */
        if (m->qc) 
                qc_clean(m->qc, false);
-       stack_pop_until(m, NR_GLOBAL_VARS);
        if (name && name[0] != '\0') {
                while (tr && (!tr->name || strcmp(tr->name, name) != 0))
                        tr = tr->parent;
diff --git a/sql/server/sql_scan.c b/sql/server/sql_scan.c
--- a/sql/server/sql_scan.c
+++ b/sql/server/sql_scan.c
@@ -1157,25 +1157,36 @@ tokenize(mvc * c, int cur)
                } else if (iswdigit(cur)) {
                        return number(c, cur);
                } else if (iswalpha(cur) || cur == '_') {
-                       if ((cur == 'E' || cur == 'e') &&
-                           lc->rs->buf[lc->rs->pos + lc->yycur] == '\'') {
-                               return scanner_string(c, scanner_getc(lc), 
true);
-                       }
-                       if ((cur == 'X' || cur == 'x') &&
-                           lc->rs->buf[lc->rs->pos + lc->yycur] == '\'') {
-                               return scanner_string(c, scanner_getc(lc), 
true);
-                       }
-                       if ((cur == 'R' || cur == 'r') &&
-                           lc->rs->buf[lc->rs->pos + lc->yycur] == '\'') {
-                               return scanner_string(c, scanner_getc(lc), 
false);
-                       }
-
-                       if ((cur == 'U' || cur == 'u') &&
-                           lc->rs->buf[lc->rs->pos + lc->yycur] == '&' &&
-                           (lc->rs->buf[lc->rs->pos + lc->yycur + 1] == '\'' ||
-                            lc->rs->buf[lc->rs->pos + lc->yycur + 1] == '"')) {
-                               cur = scanner_getc(lc); /* '&' */
-                               return scanner_string(c, scanner_getc(lc), 
false);
+                       switch (cur) {
+                       case 'e': /* string with escapes */
+                       case 'E':
+                               if (scanner_read_more(lc, 1) != EOF &&
+                                   lc->rs->buf[lc->rs->pos + lc->yycur] == 
'\'') {
+                                       return scanner_string(c, 
scanner_getc(lc), true);
+                               }
+                               break;
+                       case 'x': /* blob */
+                       case 'X':
+                       case 'r': /* raw string */
+                       case 'R':
+                               if (scanner_read_more(lc, 1) != EOF &&
+                                   lc->rs->buf[lc->rs->pos + lc->yycur] == 
'\'') {
+                                       return scanner_string(c, 
scanner_getc(lc), false);
+                               }
+                               break;
+                       case 'u': /* unicode string */
+                       case 'U':
+                               if (scanner_read_more(lc, 1) != EOF &&
+                                   lc->rs->buf[lc->rs->pos + lc->yycur] == '&' 
&&
+                                   scanner_read_more(lc, 2) != EOF &&
+                                   (lc->rs->buf[lc->rs->pos + lc->yycur + 1] 
== '\'' ||
+                                    lc->rs->buf[lc->rs->pos + lc->yycur + 1] 
== '"')) {
+                                       cur = scanner_getc(lc); /* '&' */
+                                       return scanner_string(c, 
scanner_getc(lc), false);
+                               }
+                               break;
+                       default:
+                               break;
                        }
                        return keyword_or_ident(c, cur);
                } else if (iswpunct(cur)) {
diff --git a/sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.sql 
b/sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.sql
--- a/sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.sql
+++ b/sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.sql
@@ -36,9 +36,6 @@ set t = now();
 set t = current_timestamp;
 set t = current_time;
 rollback;
-set tt = now(); --error, tt is no longer in the scope
-set tt = current_time; --error, tt is no longer in the scope
-set tt = current_timestamp; --error, tt is no longer in the scope
 
 create table d(t timestamp default current_time, i integer);
 create table d(t time default current_timestamp, i integer);
diff --git 
a/sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.err 
b/sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.err
--- a/sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.err
+++ b/sql/test/BugTracker-2014/Tests/current_timestamp.Bug-3427.stable.err
@@ -32,19 +32,7 @@ MAPI  = (monetdb) /var/tmp/mtest-27483/.
 QUERY = set t = current_time;
 ERROR = !types timetz(7,0) and timestamp(7,0) are not equal
 CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-219658/.s.monetdb.32926
-QUERY = set tt = now(); --error, tt is no longer in the scope
-ERROR = !Variable tt unknown
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-219658/.s.monetdb.32926
-QUERY = set tt = current_time; --error, tt is no longer in the scope
-ERROR = !Variable tt unknown
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-219658/.s.monetdb.32926
-QUERY = set tt = current_timestamp; --error, tt is no longer in the scope
-ERROR = !Variable tt unknown
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-219658/.s.monetdb.32926
+MAPI  = (monetdb) /var/tmp/mtest-469359/.s.monetdb.35969
 QUERY = create table d(t timestamp default current_time, i integer);
 ERROR = !types timetz(7,0) and timestamp(7,0) are not equal
 CODE  = 42000
diff --git a/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.sql 
b/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.sql
--- a/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.sql
+++ b/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.sql
@@ -3,4 +3,4 @@ declare a int;
 set a = 2;
 select a;
 iamerror; --just an error
-select a; --error, variable cache was cleaned
+select a; --a is still there
diff --git 
a/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.err 
b/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.err
--- a/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.err
+++ b/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.err
@@ -31,10 +31,6 @@ MAPI  = (monetdb) /var/tmp/mtest-222580/
 QUERY = iamerror; --just an error
 ERROR = !syntax error, unexpected IDENT in: "iamerror"
 CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-222580/.s.monetdb.36136
-QUERY = select a; --error, variable cache was cleaned
-ERROR = !SELECT: identifier 'a' unknown
-CODE  = 42000
 
 # 15:10:20 >  
 # 15:10:20 >  "Done."
diff --git 
a/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.out 
b/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.out
--- a/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.out
+++ b/sql/test/BugTracker-2017/Tests/error-clean-cache.Bug-6351.stable.out
@@ -79,6 +79,12 @@ stdout of test 'error-clean-cache.Bug-63
 % int # type
 % 1 # length
 [ 2    ]
+#select a; --a is still there
+% . # table_name
+% single_value # name
+% int # type
+% 1 # length
+[ 2    ]
 
 # 15:10:20 >  
 # 15:10:20 >  "Done."
diff --git a/sql/test/Tests/session_vars.sql b/sql/test/Tests/session_vars.sql
--- a/sql/test/Tests/session_vars.sql
+++ b/sql/test/Tests/session_vars.sql
@@ -21,10 +21,10 @@ select @"current_user";
 select @"current_role";
 
 set test_nr = 'help'; --error, conversion failed
-set test_str = 1; --error, variable no longer in cache
-set test_boolean = 'help'; --error, variable no longer in cache
+set test_str = 1;
+set test_boolean = 'help';
 
-select @test_nr; --error, variable no longer in cache
-select @test_str; --error, variable no longer in cache
-select @test_boolean; --error, variable no longer in cache
+select @test_nr;
+select @test_str;
+select @test_boolean;
 
diff --git a/sql/test/Tests/session_vars.stable.err 
b/sql/test/Tests/session_vars.stable.err
--- a/sql/test/Tests/session_vars.stable.err
+++ b/sql/test/Tests/session_vars.stable.err
@@ -83,26 +83,10 @@ MAPI  = (monetdb) /var/tmp/mtest-222303/
 QUERY = set test_nr = 'help'; --error, conversion failed
 ERROR = !conversion of string 'help' to type int failed.
 CODE  = 22018
-MAPI  = (monetdb) /var/tmp/mtest-222303/.s.monetdb.38750
-QUERY = set test_str = 1; --error, variable no longer in cache
-ERROR = !Variable test_str unknown
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-222303/.s.monetdb.38750
-QUERY = set test_boolean = 'help'; --error, variable no longer in cache
-ERROR = !Variable test_boolean unknown
-CODE  = 42000
-MAPI  = (monetdb) /var/tmp/mtest-222303/.s.monetdb.38750
-QUERY = select @test_nr; --error, variable no longer in cache
-ERROR = !SELECT: '@test_nr' unknown
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to