Changeset: 6814048557bd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6814048557bd Modified Files: sql/backends/monet5/rel_bin.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:
We cannot assume every function with side effects and no arguments have a correspondent with 1 argument. Test for it. The 'rand' function is the exception. This fixes bug 6939 diffs (89 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 @@ -1008,12 +1008,14 @@ exp_bin(backend *be, sql_exp *e, stmt *l int nrcands = 0, push_cands = 0; if (f->func->side_effect && left && left->nrcols > 0) { - if (!exps || list_empty(exps)) - append(l, - stmt_const(be, - bin_first_column(be, left), - stmt_atom_int(be, 0))); - else if (exps_card(exps) < CARD_MULTI) { + sql_subfunc *f1 = NULL; + /* we cannot assume all SQL functions with no arguments have a correspondent with one argument, so attempt to find it. 'rand' function is the exception */ + if (list_empty(exps) && (strcmp(f->func->base.name, "rand") == 0 || (f1 = sql_find_func(sql->sa, f->func->s, f->func->base.name, 1, f->func->type, NULL)))) { + if (f1) + f = f1; + list_append(l, stmt_const(be, bin_first_column(be, left), + stmt_atom(be, atom_general(sql->sa, f1 ? &(((sql_arg*)f1->func->ops->h->data)->type) : sql_bind_localtype("int"), NULL)))); + } else if (exps_card(exps) < CARD_MULTI) { rows = bin_first_column(be, left); } } @@ -1070,7 +1072,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (f->func->rel) s = stmt_func(be, stmt_list(be, l), sa_strdup(sql->sa, f->func->base.name), f->func->rel, (f->func->type == F_UNION)); else - s = stmt_Nop(be, stmt_list(be, l), e->f); + s = stmt_Nop(be, stmt_list(be, l), f); if (!s) return NULL; if (s && isel && push_cands && s->nrcols) 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 @@ -11,6 +11,13 @@ ERROR = !Could not access wlr.config fil MAPI = (monetdb) /var/tmp/mtest-157139/.s.monetdb.38085 QUERY = select wlr.tick(); ERROR = !Could not access wlr.config file +MAPI = (monetdb) /var/tmp/mtest-92649/.s.monetdb.37718 +QUERY = select wlr.clock() from t0; +ERROR = !Could not access wlr.config file +MAPI = (monetdb) /var/tmp/mtest-92649/.s.monetdb.37718 +QUERY = select wlr.tick() from t0; +ERROR = !Current transaction is aborted (please ROLLBACK) +CODE = 25005 # 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 @@ -23,6 +23,35 @@ stdout of test 'mal-multiplex.Bug-6939` % bigint # type % 1 # length [ 0 ] +#start transaction; +#CREATE TABLE "t0" ("c0" BIGINT); +#INSERT INTO "t0" VALUES (0),(1),(2); +[ 3 ] +#select profiler.getlimit() from t0; +% .%1 # table_name +% %1 # name +% int # type +% 1 # length +[ 0 ] +[ 0 ] +[ 0 ] +#select wlc.clock() from t0; +% .%1 # table_name +% %1 # name +% clob # type +% 0 # length +[ NULL ] +[ NULL ] +[ NULL ] +#select wlc.tick() from t0; +% .%1 # table_name +% %1 # name +% bigint # type +% 1 # length +[ 0 ] +[ 0 ] +[ 0 ] +#rollback; # 16:32:49 > # 16:32:49 > "Done." _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list