Changeset: 2de5428c21ec for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2de5428c21ec
Modified Files:
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql.c
        sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.err
        sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.out
Branch: Oct2020
Log Message:

Fix for bug 6939, ie push left first column only if the cardinality is not 
atomic, otherwise is not required but the side-effect function will be called 
only once.

Also updated mvc_get_value and mvc_next_value error messages to pair with the 
bulk counterparts (This was uncovered while running tests).


diffs (111 lines):

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
@@ -1007,7 +1007,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
                stmt *rows = NULL, *isel = sel;
                int nrcands = 0, push_cands = 0;
 
-               if (f->func->side_effect && left) {
+               if (f->func->side_effect && left && left->nrcols > 0) {
                        if (!exps || list_empty(exps))
                                append(l,
                                stmt_const(be,
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -763,14 +763,14 @@ mvc_next_value(Client cntxt, MalBlkPtr m
        if (!mvc_schema_privs(be->mvc, s))
                throw(SQL, "sql.next_value", SQLSTATE(42000) "Access denied for 
%s to schema '%s'", sqlvar_get_string(find_global_var(be->mvc, 
mvc_bind_schema(be->mvc, "sys"), "current_user")), s->base.name);
        if (!(seq = find_sql_sequence(s, seqname)))
-               throw(SQL, "sql.next_value", SQLSTATE(HY050) "Failed to fetch 
sequence %s.%s", sname, seqname);
+               throw(SQL, "sql.next_value", SQLSTATE(HY050) "Cannot find the 
sequence %s.%s", sname, seqname);
 
        if (seq_next_value(seq, res)) {
                be->last_id = *res;
                sqlvar_set_number(find_global_var(be->mvc, 
mvc_bind_schema(be->mvc, "sys"), "last_id"), be->last_id);
                return MAL_SUCCEED;
        }
-       throw(SQL, "sql.next_value", SQLSTATE(42000) "Error in fetching next 
value for sequence %s.%s", sname, seqname);
+       throw(SQL, "sql.next_value", SQLSTATE(HY050) "Cannot generate next 
sequence value %s.%s", sname, seqname);
 }
 
 /* str mvc_get_value(lng *res, str *sname, str *seqname); */
@@ -792,11 +792,11 @@ mvc_get_value(Client cntxt, MalBlkPtr mb
        if (!(s = mvc_bind_schema(m, sname)))
                throw(SQL, "sql.get_value", SQLSTATE(3F000) "Cannot find the 
schema %s", sname);
        if (!(seq = find_sql_sequence(s, seqname)))
-               throw(SQL, "sql.get_value", SQLSTATE(HY050) "Failed to fetch 
sequence %s.%s", sname, seqname);
+               throw(SQL, "sql.get_value", SQLSTATE(HY050) "Cannot find the 
sequence %s.%s", sname, seqname);
 
        if (seq_get_value(seq, res))
                return MAL_SUCCEED;
-       throw(SQL, "sql.get_value", SQLSTATE(42000) "Error in fetching current 
value for sequence %s.%s", sname, seqname);
+       throw(SQL, "sql.get_value", SQLSTATE(HY050) "Cannot get sequence value 
%s.%s", sname, seqname);
 }
 
 static str
diff --git a/sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.err 
b/sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.err
--- a/sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.err
+++ b/sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.err
@@ -5,6 +5,12 @@ stderr of test 'mal-multiplex.Bug-6939` 
 # 16:32:49 >  "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-183724" "--port=30927"
 # 16:32:49 >  
 
+MAPI  = (monetdb) /var/tmp/mtest-157139/.s.monetdb.38085
+QUERY = select wlr.clock();
+ERROR = !Could not access wlr.config file 
+MAPI  = (monetdb) /var/tmp/mtest-157139/.s.monetdb.38085
+QUERY = select wlr.tick();
+ERROR = !Could not access wlr.config file 
 
 # 16:32:49 >  
 # 16:32:49 >  "Done."
diff --git a/sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.out 
b/sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.out
--- a/sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.out
+++ b/sql/test/BugTracker-2020/Tests/mal-multiplex.Bug-6939.stable.out
@@ -6,35 +6,23 @@ stdout of test 'mal-multiplex.Bug-6939` 
 # 16:32:49 >  
 
 #select profiler.getlimit();
-% . # table_name
-% getlimit # name
+% .%2 # table_name
+% %2 # name
 % int # type
 % 1 # length
 [ 0    ]
 #select wlc.clock();
-% . # table_name
-% clock # name
+% .%2 # table_name
+% %2 # name
 % clob # type
-% 11 # length
-[ "wlc.clock()"        ]
+% 0 # length
+[ NULL ]
 #select wlc.tick();
-% . # table_name
-% tick # name
+% .%2 # table_name
+% %2 # name
 % bigint # type
-% 4 # length
-[ 1234 ]
-#select wlr.clock();
-% . # table_name
-% clock # name
-% clob # type
-% 11 # length
-[ "wlr.clock()"        ]
-#select wlr.tick();
-% . # table_name
-% tick # name
-% bigint # type
-% 4 # length
-[ 1234 ]
+% 1 # length
+[ 0    ]
 
 # 16:32:49 >  
 # 16:32:49 >  "Done."
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to