MonetDB: Nov2019 - Merge with Apr2019
Changeset: 4df3987d1ee4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4df3987d1ee4 Added Files: sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.bat sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.sh sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.err sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.out sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Jira-292.sql sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Jira-292.stable.err sql/test/BugTracker-2019/Tests/prepared-select-with-error-causes-hang.Jira-292.stable.out Modified Files: sql/jdbc/tests/Tests/All sql/test/BugTracker-2019/Tests/All Branch: Nov2019 Log Message: Merge with Apr2019 diffs (247 lines): diff --git a/sql/jdbc/tests/Tests/All b/sql/jdbc/tests/Tests/All --- a/sql/jdbc/tests/Tests/All +++ b/sql/jdbc/tests/Tests/All @@ -44,3 +44,4 @@ HAVE_JDBCTESTS?Bug_Connect_as_voc_getMet HAVE_JDBCTESTS?Bug_PrepStmtSetString_6382 HAVE_JDBCTESTS?Bug_LargeQueries_6571_6693 HAVE_JDBCTESTS?Bug_IsValid_Timeout_Bug_6782 +HAVE_JDBCTESTS?Bug_PrepStmt_With_Errors_Jira292 diff --git a/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.bat b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.bat new file mode 100755 --- /dev/null +++ b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.bat @@ -0,0 +1,1 @@ +@call "%TSTSRCDIR%\Test.SQL.bat" %* diff --git a/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.sh b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.sh new file mode 100755 --- /dev/null +++ b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.SQL.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +$TSTSRCDIR/Test.SQL.sh $* diff --git a/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.err b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.err new file mode 100644 --- /dev/null +++ b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.err @@ -0,0 +1,39 @@ +stderr of test 'Bug_PrepStmt_With_Errors_Jira292` in directory 'sql/jdbc/tests` itself: + + +# 14:46:39 > +# 14:46:39 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35788" "--set" "mapi_usock=/var/tmp/mtest-8623/.s.monetdb.35788" "--set" "monet_prompt=" "--forcemito" "--dbpath=/export/scratch2/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests" +# 14:46:39 > + +# builtin opt gdk_dbpath = /export/scratch2/dinther/INSTALL/var/monetdb5/dbfarm/demo +# builtin opt gdk_debug = 0 +# builtin opt gdk_vmtrim = no +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 5 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 35788 +# cmdline opt mapi_usock = /var/tmp/mtest-8623/.s.monetdb.35788 +# cmdline opt monet_prompt = +# cmdline opt gdk_dbpath = /export/scratch2/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests +# cmdline opt gdk_debug = 536870922 + +# 14:46:39 > +# 14:46:39 > "./Bug_PrepStmtSetObject_CLOB_6349.SQL.sh" "Bug_PrepStmtSetObject_CLOB_6349" +# 14:46:39 > + + +# 14:46:39 > +# 14:46:39 > java Bug_PrepStmtSetObject_CLOB_6349 "jdbc:monetdb://toulouse:35788/mTests_sql_jdbc_tests?user=monetdb=monetdb" +# 14:46:39 > + + +# 14:46:40 > +# 14:46:40 > "Done." +# 14:46:40 > + diff --git a/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.out b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.out new file mode 100644 --- /dev/null +++ b/sql/jdbc/tests/Tests/Bug_PrepStmt_With_Errors_Jira292.stable.out @@ -0,0 +1,55 @@ +stdout of test 'Bug_PrepStmt_With_Errors_Jira292` in directory 'sql/jdbc/tests` itself: + + +# 14:46:39 > +# 14:46:39 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=35788" "--set" "mapi_usock=/var/tmp/mtest-8623/.s.monetdb.35788" "--set" "monet_prompt=" "--forcemito" "--dbpath=/export/scratch2/dinther/INSTALL/var/MonetDB/mTests_sql_jdbc_tests" +# 14:46:39 > + +# MonetDB 5 server v11.27.2 +# This is an unreleased version +# Serving database 'mTests_sql_jdbc_tests', using 8 threads +# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers +# Found 15.588 GiB available main-memory. +# Copyright (c) 1993-July 2008 CWI. +# Copyright (c) August 2008-2017 MonetDB B.V., all rights reserved +# Visit https://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://toulouse.da.cwi.nl:35788/ +# Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-8623/.s.monetdb.35788 +# MonetDB/GIS module loaded +# MonetDB/SQL module loaded + +# 20:28:13 > +# 20:28:13 >
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: e7f4287f192e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e7f4287f192e Modified Files: NT/Makefile gdk/gdk_select.c Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (25 lines): diff --git a/NT/Makefile b/NT/Makefile --- a/NT/Makefile +++ b/NT/Makefile @@ -25,6 +25,8 @@ all: _all install: targetdirs all $(MAKE) /nologo /f "$(srcdir)\Makefile.msc" "prefix=$(prefix)" "bits=$(bits)" install $(INSTALL) .monetdb "$(sysconfdir)" + +makewxs: $(PYTHON) $(NT)\mksqlwxs.py $(VERSION) "$(MAKE_INCLUDEFILE)" "$(prefix)" > "$(prefix)\MonetDB5-SQL-Installer.wxs" $(PYTHON) $(NT)\mkodbcwxs.py $(VERSION) "$(MAKE_INCLUDEFILE)" "$(prefix)" > "$(prefix)\MonetDB-ODBC-Installer.wxs" diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c --- a/gdk/gdk_select.c +++ b/gdk/gdk_select.c @@ -1201,7 +1201,8 @@ ilog2(BUN x) * v1 v2 truefalse truex < v1 or x >= v2 * v1 v2 false truetruex <= v1 or x > v2 * v1 v2 truetruetruex < v1 or x > v2 - * v2 v1 ignored ignored ignored NOTHING + * v2 v1 ignored ignored false NOTHING + * v2 v1 ignored ignored truex != nil */ BAT * BATselect(BAT *b, BAT *s, const void *tl, const void *th, ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019
Changeset: eeed34b9786c for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eeed34b9786c Modified Files: sql/server/rel_exp.c sql/test/miscellaneous/Tests/All sql/test/miscellaneous/Tests/view-mul-digits.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019
Changeset: 85fe793cc1e2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=85fe793cc1e2 Removed Files: sql/test/miscellaneous/README sql/test/miscellaneous/Tests/now.sql sql/test/miscellaneous/Tests/now.stable.err Modified Files: sql/test/miscellaneous/Tests/All sql/test/miscellaneous/Tests/select_groupby.sql sql/test/miscellaneous/Tests/select_groupby.stable.err sql/test/miscellaneous/Tests/select_groupby.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 diffs (257 lines): diff --git a/sql/test/miscellaneous/README b/sql/test/miscellaneous/README deleted file mode 100644 --- a/sql/test/miscellaneous/README +++ /dev/null @@ -1,2 +0,0 @@ -The tests in this director produce time/system/ dependent output. -It is included to ensure some testing diff --git a/sql/test/miscellaneous/Tests/All b/sql/test/miscellaneous/Tests/All --- a/sql/test/miscellaneous/Tests/All +++ b/sql/test/miscellaneous/Tests/All @@ -1,6 +1,5 @@ column_aliases declared_tables -#now trace_test simple_selects update_delete_aliases diff --git a/sql/test/miscellaneous/Tests/now.sql b/sql/test/miscellaneous/Tests/now.sql deleted file mode 100644 --- a/sql/test/miscellaneous/Tests/now.sql +++ /dev/null @@ -1,1 +0,0 @@ -select now(); diff --git a/sql/test/miscellaneous/Tests/now.stable.err b/sql/test/miscellaneous/Tests/now.stable.err deleted file mode 100644 --- a/sql/test/miscellaneous/Tests/now.stable.err +++ /dev/null @@ -1,37 +0,0 @@ -stderr of test 'now` in directory 'sql/test/miscellaneous` itself: - - -# 17:34:22 > -# 17:34:22 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=33116" "--set" "mapi_usock=/var/tmp/mtest-28433/.s.monetdb.33116" "--set" "monet_prompt=" "--forcemito" "--set" "mal_listing=2" "--dbpath=/home/manegold/Monet/_/prefix/_/var/MonetDB/mTests_sql_test_miscellaneous" "--set" "mal_listing=0" "--set" "embedded_r=yes" -# 17:34:22 > - -# builtin opt gdk_dbpath = /home/manegold/Monet/_/prefix/_/var/monetdb5/dbfarm/demo -# builtin opt gdk_debug = 0 -# builtin opt gdk_vmtrim = no -# builtin opt monet_prompt = > -# builtin opt monet_daemon = no -# builtin opt mapi_port = 5 -# builtin opt mapi_open = false -# builtin opt mapi_autosense = false -# builtin opt sql_optimizer = default_pipe -# builtin opt sql_debug = 0 -# cmdline opt gdk_nr_threads = 0 -# cmdline opt mapi_open = true -# cmdline opt mapi_port = 33116 -# cmdline opt mapi_usock = /var/tmp/mtest-28433/.s.monetdb.33116 -# cmdline opt monet_prompt = -# cmdline opt mal_listing = 2 -# cmdline opt gdk_dbpath = /home/manegold/Monet/_/prefix/_/var/MonetDB/mTests_sql_test_miscellaneous -# cmdline opt mal_listing = 0 -# cmdline opt embedded_r = yes -# cmdline opt gdk_debug = 536870922 - -# 17:34:23 > -# 17:34:23 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-28433" "--port=33116" -# 17:34:23 > - - -# 17:34:23 > -# 17:34:23 > "Done." -# 17:34:23 > - diff --git a/sql/test/miscellaneous/Tests/select_groupby.sql b/sql/test/miscellaneous/Tests/select_groupby.sql --- a/sql/test/miscellaneous/Tests/select_groupby.sql +++ b/sql/test/miscellaneous/Tests/select_groupby.sql @@ -110,4 +110,77 @@ exec ** ('a', 'b', 923, 51, 942, 544); create function "sys"."dummy"("col1" blob, "col2" blob, "col3" integer) returns boolean external name "unknown"."idontexist"; --error, MAL implementation of sys.dummy doesn't exist. SELECT "sys"."dummy"("fortieth-second", blob '', '0') AS "alias1", "fortieth-third" FROM "myschema"."mytable"; --error, function doesn't exist +create table "myschema"."mytable2" +( +"'col1'" date, +"'col2'" int, +"'col3'" varchar(256), +"'col4'" clob, +"'col5'" clob, +"'col6'" decimal, +"'col7'" decimal, +"'col8'" date, +"'col9'" date, +"'col10'" int, +"'col11'" int, +"'col12'" decimal, +"'col13'" int, +"'col14'" varchar(256), +"'col15'" varchar(256), +"'col16'" int, +"'col17'" varchar(256), +"'col18'" int, +"'col19'" varchar(256), +"'col20'" bigint, +"'col21'" varchar(256), +"'col22'" varchar(256), +"'col23'" varchar(256), +"'col24'" varchar(256), +"'col25'" int, +"'col26'" varchar(256), +"'col27'" clob, +"'col28'" varchar(256), +"'col29'" decimal, +"'col30'" decimal, +"'col31'" decimal, +"'col32'" decimal, +"'col33'" clob, +"'col34'" clob, +"'col35'" int, +"'col36'" int +); + +insert into "myschema"."mytable2" values ( +'1998-01-03', 2239, 'col3', 'col4', 'col5', 73.28, 68.29, '2005-05-12', '2010-03-03', 563, 63, 56.3, 852, 'col14', +'col15', 134, 'col17', 892, 'col19', 9348, 'col21', 'col22', 'col23', 'col24', 934, 'col26', 'col27', 'col28', 849.2739, 1742.718, +395.824, 39.824, 'col33', 'col34', 395824, 3789); + +SELECT "'col26'" FROM "myschema"."mytable2" WHERE +( ( ("'col19'"='Some information of my hobby')) AND +( ("'col9'"='' AND "'col3'"='ABCDE' AND (EXTRACT(YEAR FROM "'col1'")*100 + EXTRACT(MONTH FROM "'col1'"))/100.0='2011.040' +AND "'col14'"='A
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: 896b634f58e0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=896b634f58e0 Modified Files: sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_upgrades.c sql/test/BugTracker-2012/Tests/create_function.Bug-3172.sql sql/test/BugTracker-2012/Tests/create_function.Bug-3172.stable.err sql/test/BugTracker-2012/Tests/create_function.Bug-3172.stable.out sql/test/BugTracker-2012/Tests/table_function_with_column_subselects.Bug-3172.sql sql/test/BugTracker-2012/Tests/table_function_with_column_subselects.Bug-3172.stable.err sql/test/BugTracker-2019/Tests/disallow_duplicate_column_aliases.Bug-6723.stable.out sql/test/BugTracker-2019/Tests/prepare-types.Bug-6724.stable.out sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (truncated from 952 to 300 lines): diff --git a/sql/backends/monet5/sql_gencode.c b/sql/backends/monet5/sql_gencode.c --- a/sql/backends/monet5/sql_gencode.c +++ b/sql/backends/monet5/sql_gencode.c @@ -833,7 +833,7 @@ backend_call(backend *be, Client c, cq * sql_subtype *pt = cq->params + i; if (!atom_cast(m->sa, a, pt)) { - sql_error(m, 003, SQLSTATE(42000) "wrong type for argument %d of " "function call: %s, expected %s\n", i + 1, atom_type(a)->type->sqlname, pt->type->sqlname); + sql_error(m, 003, SQLSTATE(42000) "wrong type for argument %d of function call: %s, expected %s\n", i + 1, atom_type(a)->type->sqlname, pt->type->sqlname); break; } if (atom_null(a)) { @@ -855,31 +855,33 @@ backend_call(backend *be, Client c, cq * int monet5_resolve_function(ptr M, sql_func *f) { + Client c; + Module m; + mvc *sql = (mvc *) M; str mname = getName(f->mod), fname = getName(f->imp); - (void) M; if (!mname || !fname) return 0; - for (Module m = getModule(mname); m; m = m->link) { + /* Some SQL functions MAL mapping such as count(*) aggregate, the number or arguments don't match */ + if (mname == calcRef && fname == getName("=")) + return 1; + if (mname == aggrRef && fname == countRef) + return 1; + if (mname == sqlRef && (fname == first_valueRef || fname == minRef || fname == maxRef)) + return 1; + + c = MCgetClient(sql->clientid); + for (m = findModule(c->usermodule, mname); m; m = m->link) { for (Symbol s = findSymbolInModule(m, fname); s; s = s->peer) { InstrPtr sig = getSignature(s); - int argc = sig->argc - sig->retc; + int argc = sig->argc - sig->retc, fargs = list_length(f->ops); - if ((!f->ops && argc == 0) || list_length(f->ops) == argc || (sig->varargs & VARARGS) == VARARGS) + if (fargs == argc || (sig->varargs & VARARGS) == VARARGS) return 1; } } return 0; -/* - node *n; - newFcnCall(f->mod, f->imp); - for (n = f->ops->h; n; n = n->next) { - sql_arg *a = n->data; - - q = push ?type? (mb, q, a->); - } -*/ } static int @@ -1015,6 +1017,83 @@ backend_create_c_func(backend *be, sql_f return 0; } +/* Parse the SQL query from the function, and
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: b6a5ccf2086e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b6a5ccf2086e Modified Files: sql/backends/monet5/sql_upgrades.c Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (12 lines): diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -1544,7 +1544,7 @@ sql_update_storagemodel(Client c, mvc *s if ((buf = GDKmalloc(bufsize)) == NULL) throw(SQL, "sql_update_storagemodel", SQLSTATE(HY001) MAL_MALLOC_FAIL); - + /* set views and tables internally to non-system to allow drop commands to succeed without error */ if ((t = mvc_bind_table(sql, s, "storage")) != NULL) t->system = 0; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: b496d502ec4e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b496d502ec4e Modified Files: monetdb5/mal/mal_module.c sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_gencode.c Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (75 lines): diff --git a/monetdb5/mal/mal_module.c b/monetdb5/mal/mal_module.c --- a/monetdb5/mal/mal_module.c +++ b/monetdb5/mal/mal_module.c @@ -117,7 +117,7 @@ Module getModule(str name) { int index = getModuleIndex(name); Module m = moduleIndex[index]; while(m) { - if (strcmp(name, m->name) == 0) + if (name == m->name) return m; m = m->link; } diff --git a/sql/backends/monet5/sql_cat.c b/sql/backends/monet5/sql_cat.c --- a/sql/backends/monet5/sql_cat.c +++ b/sql/backends/monet5/sql_cat.c @@ -782,10 +782,15 @@ create_func(mvc *sql, char *sname, char s = cur_schema(sql); nf = mvc_create_func(sql, NULL, s, f->base.name, f->ops, f->res, f->type, f->lang, f->mod, f->imp, f->query, f->varres, f->vararg, f->system); assert(nf); - if (nf->lang == FUNC_LANG_INT || nf->lang == FUNC_LANG_MAL) { /* FUNC_LANG_INT shouldn't be reachable, but leave it here */ + switch (nf->lang) { + case FUNC_LANG_INT: + case FUNC_LANG_MAL: /* shouldn't be reachable, but leave it here */ if (!backend_resolve_function(sql, nf)) throw(SQL,"sql.create_func", SQLSTATE(3F000) "CREATE %s%s: external name %s.%s not bound", KF, F, nf->mod, nf->base.name); - } else if (nf->lang == FUNC_LANG_SQL) { + if (nf->query == NULL) + break; + /* fall through */ + case FUNC_LANG_SQL: { char *buf; sql_rel *r = NULL; sql_allocator *sa = sql->sa; @@ -825,6 +830,9 @@ create_func(mvc *sql, char *sname, char sa_destroy(sql->sa); sql->sa = sa; } + default: + break; + } return MAL_SUCCEED; } diff --git a/sql/backends/monet5/sql_gencode.c b/sql/backends/monet5/sql_gencode.c --- a/sql/backends/monet5/sql_gencode.c +++ b/sql/backends/monet5/sql_gencode.c @@ -855,19 +855,19 @@ backend_call(backend *be, Client c, cq * int monet5_resolve_function(ptr M, sql_func *f) { + str mname = getName(f->mod), fname = getName(f->imp); (void) M; - for (Module m = getModule(f->mod); m; m = m->link) { - if (strcmp(m->name, f->mod) == 0) { - Symbol s = m->space[(int) (getSymbolIndex(f->imp))]; - for (; s; s = s->peer) { - InstrPtr sig = getSignature(s); - int argc = sig->argc - sig->retc; + if (!mname || !fname) + return 0; - if (strcmp(s->name, f->imp) == 0 && ((!f->ops && argc == 0) || list_length(f->ops) == argc || (sig->varargs & VARARGS) == VARARGS)) - return 1; + for (Module m = getModule(mname); m; m = m->link) { + for (Symbol s = findSymbolInModule(m, fname); s; s = s->peer) { + InstrPtr sig = getSignature(s); + int argc = sig->argc - sig->retc; - } + if ((!f->ops && argc == 0) || list_length(f->ops) == argc || (sig->varargs & VARARGS) == VARARGS) + return 1; } } return 0; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019
Changeset: da5a0edf3394 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=da5a0edf3394 Modified Files: NT/monetdb_config.h.in common/utils/mutils.c configure.ag gdk/gdk_posix.c gdk/gdk_system.c gdk/gdk_system.h gdk/gdk_utils.c monetdb5/mal/mal_module.c sql/backends/monet5/sql_cat.c sql/backends/monet5/sql_gencode.c sql/scripts/Makefile.ag sql/server/rel_psm.c sql/server/rel_schema.c sql/server/sql_parser.y sql/test/miscellaneous/Tests/select_groupby.sql sql/test/miscellaneous/Tests/select_groupby.stable.err tools/merovingian/daemon/merovingian.c Branch: Nov2019 Log Message: Merge with Apr2019 diffs (truncated from 314 to 300 lines): diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in --- a/NT/monetdb_config.h.in +++ b/NT/monetdb_config.h.in @@ -508,9 +508,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_SYSCTL_H */ - /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_TIMES_H */ diff --git a/common/utils/mutils.c b/common/utils/mutils.c --- a/common/utils/mutils.c +++ b/common/utils/mutils.c @@ -25,10 +25,10 @@ #include /* PATH_MAX on Solaris */ #ifdef HAVE_SYS_PARAM_H -# include /* realpath on OSX, prerequisite of sys/sysctl on OpenBSD */ +# include /* realpath on OSX */ #endif -#ifdef HAVE_SYS_SYSCTL_H +#ifdef BSD /* BSD macro is defined in sys/param.h */ # include /* KERN_PROC_PATHNAME on BSD */ #endif @@ -454,7 +454,7 @@ get_bin_path(void) if (_NSGetExecutablePath(buf, ) == 0 && realpath(buf, _bin_path) != NULL) return _bin_path; -#elif defined(HAVE_SYS_SYSCTL_H) && defined(KERN_PROC_PATHNAME) /* BSD */ +#elif defined(BSD) && defined(KERN_PROC_PATHNAME) /* BSD */ int mib[4]; size_t cb = sizeof(_bin_path); mib[0] = CTL_KERN; diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c --- a/gdk/gdk_posix.c +++ b/gdk/gdk_posix.c @@ -34,7 +34,7 @@ #ifdef HAVE_MACH_MACH_INIT_H # include #endif -#if defined(HAVE_KVM_H) && defined(HAVE_SYS_SYSCTL_H) +#if defined(HAVE_KVM_H) # include # include # include @@ -297,7 +297,7 @@ MT_getrss(void) if (task_info(task, TASK_BASIC_INFO_64, (task_info_t)_info, _info_count) != KERN_INVALID_POLICY) return t_info.resident_size; /* bytes */ -#elif defined(HAVE_KVM_H) && defined(HAVE_SYS_SYSCTL_H) +#elif defined(HAVE_KVM_H) /* get RSS on FreeBSD and NetBSD */ struct kinfo_proc *ki; int ski = 1; diff --git a/gdk/gdk_system.c b/gdk/gdk_system.c --- a/gdk/gdk_system.c +++ b/gdk/gdk_system.c @@ -847,7 +847,7 @@ MT_check_nr_cores(void) #if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) /* this works on Linux, Solaris and AIX */ ncpus = sysconf(_SC_NPROCESSORS_ONLN); -#elif defined(HAVE_SYS_SYSCTL_H) && defined(HW_NCPU) /* BSD */ +#elif defined(HW_NCPU) /* BSD */ size_t len = sizeof(int); int mib[3]; diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h --- a/gdk/gdk_system.h +++ b/gdk/gdk_system.h @@ -98,7 +98,7 @@ #ifdef HAVE_SYS_PARAM_H # include/* prerequisite of sys/sysctl on OpenBSD */ #endif -#ifdef HAVE_SYS_SYSCTL_H +#ifdef BSD /* BSD macro is defined in sys/param.h */ # include #endif diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -39,7 +39,7 @@ int GDKverbose = 0; #ifdef HAVE_SYS_PARAM_H # include /* prerequisite of sys/sysctl on OpenBSD */ #endif -#ifdef HAVE_SYS_SYSCTL_H +#ifdef BSD /* BSD macro is defined in sys/param.h */ # include #endif #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) @@ -317,7 +317,7 @@ MT_init(void) GetSystemInfo(); _MT_pagesize = sysInfo.dwPageSize; } -#elif defined(HAVE_SYS_SYSCTL_H) && defined(HW_PAGESIZE) +#elif defined(BSD) && defined(HW_PAGESIZE) { int size; size_t len = sizeof(int); @@ -344,7 +344,7 @@ MT_init(void) if (GlobalMemoryStatusEx()) _MT_npages = (size_t) (memStatEx.ullTotalPhys / _MT_pagesize); } -#elif defined(HAVE_SYS_SYSCTL_H) && defined(HW_MEMSIZE) && SIZEOF_SIZE_T == SIZEOF_LNG +#elif defined(BSD) && defined(HW_MEMSIZE) && SIZEOF_SIZE_T == SIZEOF_LNG /* Darwin, 64-bits */ { uint64_t size = 0; @@ -358,7 +358,7 @@ MT_init(void) sysctl(mib, 2, , , NULL, 0); _MT_npages = size / _MT_pagesize; } -#elif defined(HAVE_SYS_SYSCTL_H) && defined (HW_PHYSMEM64) && SIZEOF_SIZE_T == SIZEOF_LNG +#elif defined(BSD) && defined (HW_PHYSMEM64) && SIZEOF_SIZE_T == SIZEOF_LNG /* OpenBSD, 64-bits */ { int64_t size = 0; @@ -372,7 +372,7 @@ MT_init(void)
MonetDB: Nov2019 - Merge with Apr2019
Changeset: af7bfd5c27da for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=af7bfd5c27da Added Files: sql/test/miscellaneous/Tests/select_groupby.sql sql/test/miscellaneous/Tests/select_groupby.stable.err sql/test/miscellaneous/Tests/select_groupby.stable.out Modified Files: sql/test/miscellaneous/Tests/All Branch: Nov2019 Log Message: Merge with Apr2019 diffs (truncated from 417 to 300 lines): diff --git a/sql/test/miscellaneous/Tests/All b/sql/test/miscellaneous/Tests/All --- a/sql/test/miscellaneous/Tests/All +++ b/sql/test/miscellaneous/Tests/All @@ -10,3 +10,4 @@ with_update_stmts groupby_error alter_table_add_column view-mul-digits +select_groupby diff --git a/sql/test/miscellaneous/Tests/select_groupby.sql b/sql/test/miscellaneous/Tests/select_groupby.sql new file mode 100644 --- /dev/null +++ b/sql/test/miscellaneous/Tests/select_groupby.sql @@ -0,0 +1,111 @@ +start transaction; +create schema "myschema"; +create sequence "myschema"."myseq"; +create table myschema.mytable +( + "first" char(100), + "second" double, + "third" double, + "fourth" clob, + "fifth" clob, + "sixth" double, + "seventh" clob, + "eighth" date, + "ninth" double, + "tenth" double, + "eleventh" char(100), + "tweelfth" char(4), + "thirteenth" char(50), + "fourteenth" char(50), + "fifteenth" clob, + "sixteenth" char(100), + "seventeenth" char(100), + "eighteenth" char(30), + "nineteenth" double, + "twentieth" char(100), + "twentieth-first" clob, + "twentieth-second" double, + "twentieth-third" double, + "twentieth-fourth" double, + "twentieth-fifth" double, + "twentieth-sixth" double, + "twentieth-seventh" char(100), + "twentieth-eighth" char(100), + "twentieth-ninth" char(100), + "thirtieth" char(14), + "thirtieth-first" bigint, + "thirtieth-second" bigint, + "thirtieth-third" bigint, + "thirtieth-fourth" bigint, + "thirtieth-fifth" bigint, + "thirtieth-sixth" bigint, + "thirtieth-seventh" bigint, + "thirtieth-eighth" bigint, + "thirtieth-ninth" bigint, + "fortieth" bigint, + "fortieth-first" tinyint, + "fortieth-second" blob, + "fortieth-third" int default next value for "myschema"."myseq" +); +INSERT INTO myschema.mytable ("first", "second", "third", "fourth", "fifth", "sixth", "seventh", "eighth", "ninth", "tenth", "eleventh", "tweelfth", "thirteenth", "fourteenth", "fifteenth", "sixteenth", + "seventeenth", "eighteenth", "nineteenth", "twentieth", "twentieth-first", "twentieth-second", "twentieth-third", "twentieth-fourth", "twentieth-fifth", "twentieth-sixth", + "twentieth-seventh", "twentieth-eighth", "twentieth-ninth", "thirtieth", "thirtieth-first", "thirtieth-second", "thirtieth-third", "thirtieth-fourth", "thirtieth-fifth", + "thirtieth-sixth", "thirtieth-seventh", "thirtieth-eighth", "thirtieth-ninth", "fortieth", "fortieth-first", "fortieth-second", "fortieth-third") + VALUES ('1234 / 0', 1234, 1, 'have', 'a', 850.85, 'very', '2019-03-18', 2, 16, 'nice', 'CC', 'DD', 'Day', 'somewhere', 'you', 'will', '3840', + 455, '11790 - Something', 'Paper', 850.83, 344, 0, 506.83, 59.5689, 'Good', 'Food', 'hello', '001234/00', 301215, 303378, 300346, + 303378, 300346, 32, 300015, 31, null, 300073, 0, null, 1); +SELECT +mytable."eighth" AS "first-projection", +mytable."twentieth", mytable."twentieth-seventh", +mytable."twentieth-third", mytable."twentieth-second" +FROM myschema.mytable +WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = '2014.030') +GROUP BY "first-projection", "twentieth", "twentieth-seventh", "twentieth-third", "twentieth-second" LIMIT 1001; + +PREPARE SELECT +mytable."eighth" AS "first-projection", +mytable."twentieth", mytable."twentieth-seventh", +mytable."twentieth-third", mytable."twentieth-second" +FROM myschema.mytable +WHERE ("first" = '227 / 0' AND "eleventh" = 'Lekker' AND (EXTRACT(YEAR FROM mytable."eighth")*100 + EXTRACT(MONTH FROM mytable."eighth"))/100.0 = '2014.030') +GROUP BY "first-projection", "twentieth", "twentieth-seventh", "twentieth-third", "twentieth-second" LIMIT 1001; +exec ** (); + +PREPARE SELECT +mytable."eighth" AS "first-projection", +mytable."twentieth", mytable."twentieth-seventh", +mytable."twentieth-third", mytable."twentieth-second" +FROM myschema.mytable +WHERE ("first"
MonetDB: Nov2019 - Merge with Apr2019
Changeset: 677e40b41770 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=677e40b41770 Modified Files: sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.sql sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.stable.out sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.32bit Branch: Nov2019 Log Message: Merge with Apr2019 diffs (20 lines): diff --git a/sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.sql b/sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.sql --- a/sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.sql +++ b/sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.sql @@ -56,3 +56,5 @@ create view s0_mix_source_string_result_ -- The INSERT INTO fails insert into resultbuffer_int_str (q, i1,s1, prob) select cast(0 as int) as q,a1, a2, prob from s0_mix_source_string_result_result as r; +ROLLBACK; + diff --git a/sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.stable.out b/sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.stable.out --- a/sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.stable.out +++ b/sql/test/BugTracker-2019/Tests/crash-in-rel_dependencies.Bug-6703.stable.out @@ -70,6 +70,7 @@ stdout of test 'crash-in-rel_dependencie #create view s0_mix_source_string_result_result as with q0_x0 as (select a1, prob from (select cachedrel_44.a1 as a1, cachedrel_44.a2 as a2, cachedrel_44.a3 as a3, t__x2.a1 as a4, cachedrel_44.prob * t__x2.prob as prob from cachedrel_44,(select a2 as a1, prob from (select paramname as a1, value as a2, prob from paramsint where paramname = 's0_userid') as t__x1) as t__x2 where cachedrel_44.a3 = t__x2.a1) as t__x3),q0_x1 as (select a1, prob from (select cachedrel_6.a1 as a1, q0_x0.a1 as a2, cachedrel_6.prob * q0_x0.prob as prob from cachedrel_6,q0_x0 where cachedrel_6.a1 = q0_x0.a1) as t__x5),q0_x2 as (select a1, prob from (select cachedrel_647.a1 as a1, cachedrel_647.a2 as a2, q0_x1.a1 as a3, cachedrel_647.prob * q0_x1.prob as prob from cachedrel_647,q0_x1 where cachedrel_647.a2 = q0_x1.a1) as t__x7),q0_x3 as (select a1, 1 as prob from q0_x2),q0_x4 as (select a1, a4 as a2, prob from (select q0_x3.a1 as a1, cachedrel_33.a1 as a2, cachedrel_33.a2 as a3, cachedrel_33.a3 as a4, q0_x3.pro b * cachedrel_33.prob as prob from q0_x3,cachedrel_33 where q0_x3.a1 = cachedrel_33.a1) as t__x9),q0_x5 as (select a2 as a1, max(prob) as prob from q0_x4 group by a2),q0_x8 as (select a1, prob from (select q0_x5.a1 as a1, q0_x5.prob / t__x11.prob as prob from q0_x5,(select max(prob) as prob from q0_x5) as t__x11) as t__x12),q0_x9 as (select a1, a4 as a2, prob from (select q0_x8.a1 as a1, cachedrel_84.a1 as a2, cachedrel_84.a2 as a3, cachedrel_84.a3 as a4, q0_x8.prob * cachedrel_84.prob as prob from q0_x8,cachedrel_84 where q0_x8.a1 = cachedrel_84.a1) as t__x14),q0_x10 as (select a2 as a1, max(prob) as prob from q0_x9 group by a2),q0_x12 as (select a1, a4 as a2, prob from (select q0_x10.a1 as a1, cachedrel_84.a1 as a2, cachedrel_84.a2 as a3, cachedrel_84.a3 as a4, q0_x10.prob * cachedrel_84.prob as prob from q0_x10,cachedrel_84 where q0_x10.a1 = cachedrel_84.a1) as t__x16),q0_x13 as (select a2 as a1, max(prob) as prob from q0_x12 group by a2),q0_x15 as (select a1, a4 as a2, prob from (select q0_x13.a1 as a1, cachedrel_84.a1 as a2, cachedrel_84.a2 as a3, cachedrel_84.a3 as a4, q0_x13.prob * cachedrel_84.prob as prob from q0_x13,cachedrel_84 where q0_x13.a1 = cachedrel_84.a1) as t__x18),q0_x16 as (select a2 as a1, max(prob) as prob from q0_x15 group by a2),q0_x18 as (select a1, a4 as a2, prob from (select q0_x16.a1 as a1, cachedrel_104.a1 as a2, cachedrel_104.a2 as a3, cachedrel_104.a3 as a4, q0_x16.prob * cachedrel_104.prob as prob from q0_x16,cachedrel_104 where q0_x16.a1 = cachedrel_104.a1) as t__x20),q0_x19 as (select a2 as a1, max(prob) as prob from q0_x18 group by a2),q0_x20 as (select a1, a4 as a2, prob from (select q0_x19.a1 as a1, cachedrel_104.a1 as a2, cachedrel_104.a2 as a3, cachedrel_104.a3 as a4, q0_x19.prob * cachedrel_104.prob as prob from q0_x19,cachedrel_104 where q0_x19.a1 = cachedrel_104.a1) as t__x22),q0_x21 as (select a2 as a1, max(prob) as prob from q0_x20 group by a2),q0_x22 as (select a1, a4 as a2, prob from (select q0_x21.a1 as a1, cache drel_104.a1 as a2, cachedrel_104.a2 as a3, cachedrel_104.a3 as a4, q0_x21.prob * cachedrel_104.prob as prob from q0_x21,cachedrel_104 where q0_x21.a1 = cachedrel_104.a1) as t__x24),q0_x23 as (select a2 as a1, max(prob) as prob from q0_x22 group by a2),q0_x24 as
MonetDB: Nov2019 - Merge with Apr2019
Changeset: 7ab514fbface for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7ab514fbface Modified Files: sql/backends/monet5/sql_upgrades.c Branch: Nov2019 Log Message: Merge with Apr2019 diffs (60 lines): diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -1898,6 +1898,45 @@ sql_update_apr2019_sp1(Client c) return err; /* usually MAL_SUCCEED */ } +static str +sql_update_apr2019_sp2(Client c) +{ + /* Determine if system function sys.prod(decimal) exists in sys.functions, if so remove them. +* see also https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f93d5290abe4 +*/ + char *err = NULL; + char *qry = "select f.id from sys.functions f where f.name = 'prod' and func = 'prod'" + " and mod in ('sql', 'aggr') and language = 0 and f.type in (3,6) and f.system" + " and schema_id in (select s.id from sys.schemas s where s.name = 'sys')" + " and f.id in (select a.func_id from sys.args a where a.type = 'decimal'" + " and type_digits in (2,4,9,18,38) and a.name in ('arg','arg_1') and inout = 1 and number = 1);"; + res_table *output = NULL; + + err = SQLstatementIntern(c, , "update", true, false, ); + if (err == NULL) { + BAT *b = BATdescriptor(output->cols[0].b); + if (b) { + if (BATcount(b) > 0) { + /* found entries, we need to remove them sys.functions and sys.args */ + char *upd = "delete from sys.functions f where f.name = 'prod' and func = 'prod'" + " and mod in ('sql', 'aggr') and language = 0 and f.type in (3,6) and f.system" + " and schema_id in (select s.id from sys.schemas s where s.name = 'sys')" + " and f.id in (select a.func_id from sys.args a where a.type = 'decimal'" + " and type_digits in (2,4,9,18,38) and a.name in ('arg','arg_1') and inout = 1 and number = 1);\n" + "delete from sys.args where func_id not in (select id from sys.functions);\n"; + + printf("Running database upgrade commands:\n%s\n", upd); + err = SQLstatementIntern(c, , "update", true, false, NULL); + } + BBPunfix(b->batCacheid); + } + } + if (output != NULL) + res_tables_destroy(output); + + return err; /* usually MAL_SUCCEED */ +} + #define FLUSH_INSERTS_IF_BUFFERFILLED /* Each new value should add about 20 bytes to the buffer, "flush" when is 200 bytes from being full */ \ if (pos > 7900) { \ pos += snprintf(buf + pos, bufsize - pos, ") as t1(c1,c2,c3) where t1.c1 not in (select \"id\" from dependencies where depend_id = t1.c2);\n"); \ @@ -2456,6 +2495,10 @@ SQLupgrades(Client c, mvc *m) fprintf(stderr, "!%s\n", err); freeException(err); } + if ((err = sql_update_apr2019_sp2(c)) != NULL) { + fprintf(stderr, "!%s\n", err); + freeException(err); + } sql_find_subtype(, "string", 0, 0); if (!sql_bind_func3(m->sa, s, "deltas", , , , F_UNION)) { ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019
Changeset: c6169ddca7cb for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c6169ddca7cb Modified Files: sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 Branch: Nov2019 Log Message: Merge with Apr2019 ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: 5cc8dcdf8a2f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5cc8dcdf8a2f Modified Files: clients/mapiclient/eventparser.c Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (12 lines): diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c --- a/clients/mapiclient/eventparser.c +++ b/clients/mapiclient/eventparser.c @@ -229,7 +229,7 @@ keyvalueparser(char *txt, EventRecord *e curr_time = *localtime(); #endif ev->time = malloc(DATETIME_CHAR_LENGTH*sizeof(char)); - snprintf(ev->time, DATETIME_CHAR_LENGTH, "%d/%02d/%02d %02d:%02d:%02d.%lu", + snprintf(ev->time, DATETIME_CHAR_LENGTH, "%d/%02d/%02d %02d:%02d:%02d.%"PRIu64, curr_time.tm_year + 1900, curr_time.tm_mon, curr_time.tm_mday, curr_time.tm_hour, curr_time.tm_min, curr_time.tm_sec, microsec); ev->clkticks = sec * 100; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge branch Apr2019 into Nov2019
Changeset: a954ebff3c16 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a954ebff3c16 Modified Files: clients/mapiclient/eventparser.c monetdb5/mal/mal_profiler.c Branch: Nov2019 Log Message: Merge branch Apr2019 into Nov2019 diffs (52 lines): diff --git a/clients/mapiclient/eventparser.c b/clients/mapiclient/eventparser.c --- a/clients/mapiclient/eventparser.c +++ b/clients/mapiclient/eventparser.c @@ -205,12 +205,13 @@ keyvalueparser(char *txt, EventRecord *e *c = 0; } else val =c; - if( strstr(key,"clk")){ + if( strstr(key,"ctime")){ ev->usec = atol(val); return 0; } - if( strstr(key,"ctime")){ + if( strstr(key,"clk")){ time_t sec; + uint64_t microsec; struct tm curr_time; c = strchr(val,'.'); @@ -220,16 +221,17 @@ keyvalueparser(char *txt, EventRecord *e } sec = atol(val); + microsec = sec % 100; + sec /= 100; #ifdef HAVE_LOCALTIME_R (void)localtime_r(, _time); #else curr_time = *localtime(); #endif ev->time = malloc(DATETIME_CHAR_LENGTH*sizeof(char)); - snprintf(ev->time, DATETIME_CHAR_LENGTH, "%d/%02d/%02d %02d:%02d:%02d.%s", + snprintf(ev->time, DATETIME_CHAR_LENGTH, "%d/%02d/%02d %02d:%02d:%02d.%lu", curr_time.tm_year + 1900, curr_time.tm_mon, curr_time.tm_mday, -curr_time.tm_hour, curr_time.tm_min, curr_time.tm_sec, -c); +curr_time.tm_hour, curr_time.tm_min, curr_time.tm_sec, microsec); ev->clkticks = sec * 100; if (c != NULL) { int64_t usec; diff --git a/monetdb5/mal/mal_profiler.c b/monetdb5/mal/mal_profiler.c --- a/monetdb5/mal/mal_profiler.c +++ b/monetdb5/mal/mal_profiler.c @@ -144,7 +144,7 @@ renderProfilerEvent(MalBlkPtr mb, MalStk str stmt, c; str stmtq; lng usec= GDKusec(); - uint64_t microseconds = (uint64_t)startup_time.tv_sec*100 + (uint64_t)startup_time.tv_usec + (uint64_t)usec; + uint64_t microseconds = (uint64_t)usec - ((uint64_t)startup_time.tv_sec*100 - (uint64_t)startup_time.tv_usec); // ignore generation of events for instructions that are called too often if(highwatermark && highwatermark + (start == 0) < pci->calls) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019
Changeset: 20a0fb731200 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=20a0fb731200 Modified Files: monetdb5/modules/atoms/Tests/json02.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 diffs (12 lines): diff --git a/monetdb5/modules/atoms/Tests/json02.stable.out b/monetdb5/modules/atoms/Tests/json02.stable.out --- a/monetdb5/modules/atoms/Tests/json02.stable.out +++ b/monetdb5/modules/atoms/Tests/json02.stable.out @@ -95,7 +95,7 @@ stdout of test 'json02` in directory 'mo #-# [ 0@0, "1" ] [ 1@0, "2" ] -[ 2@0, nil ] +[ 2@0, "null" ] [ 3@0, "true" ] [ 4@0, "false" ] [ 5 ] ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019
Changeset: 7030a89d5fe3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7030a89d5fe3 Modified Files: monetdb5/modules/atoms/json.c sql/test/BugTracker-2019/Tests/All sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.sql sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.err sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 diffs (150 lines): diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -512,8 +512,6 @@ JSONgetValue(JSON *jt, int idx) if (jt->elm[idx].valuelen == 0) return GDKstrdup(str_nil); - if (strncmp(jt->elm[idx].value, "null", 4) == 0) - return GDKstrdup(str_nil); s = GDKzalloc(jt->elm[idx].valuelen + 1); if (s) strncpy(s, jt->elm[idx].value, jt->elm[idx].valuelen); diff --git a/sql/test/BugTracker-2019/Tests/All b/sql/test/BugTracker-2019/Tests/All --- a/sql/test/BugTracker-2019/Tests/All +++ b/sql/test/BugTracker-2019/Tests/All @@ -38,5 +38,5 @@ HAVE_LIBPY3?python-loader-string.Bug-675 select-char.Bug-6761 grant-select-column.Bug-6765 next-get-value-bulk.Bug-6766 -KNOWNFAIL?filter_json_null.Bug-6773 +filter_json_null.Bug-6773 prod-decimals.Bug-6774 diff --git a/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.sql b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.sql --- a/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.sql +++ b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.sql @@ -1,2 +1,2 @@ select json.filter('{"foo": null}', '$.foo'); -select json.filter('[null]', '$.0'); +select json.filter('[null]', '$[0]'); diff --git a/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.err b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.err --- a/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.err +++ b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.err @@ -0,0 +1,33 @@ +stderr of test 'filter_json_null.Bug-6773` in directory 'sql/test/BugTracker-2019` itself: + + +# 15:23:55 > +# 15:23:55 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=30124" "--set" "mapi_usock=/var/tmp/mtest-13615/.s.monetdb.30124" "--set" "monet_prompt=" "--forcemito" "--dbpath=/home/kutsurak/work/monet/sources/MonetDB/build/install/var/MonetDB/mTests_sql_test_BugTracker-2019" "--set" "embedded_c=true" +# 15:23:55 > + +# builtin opt gdk_dbpath = /home/kutsurak/work/monet/sources/MonetDB/build/install/var/monetdb5/dbfarm/demo +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 5 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 30124 +# cmdline opt mapi_usock = /var/tmp/mtest-13615/.s.monetdb.30124 +# cmdline opt monet_prompt = +# cmdline opt gdk_dbpath = /home/kutsurak/work/monet/sources/MonetDB/build/install/var/MonetDB/mTests_sql_test_BugTracker-2019 +# cmdline opt embedded_c = true +#main thread:!ERROR:MALException:client.quit:Server stopped + +# 15:23:56 > +# 15:23:56 > "mclient" "-lsql" "-ftest" "-tnone" "-Eutf-8" "-i" "-e" "--host=/var/tmp/mtest-13615" "--port=30124" +# 15:23:56 > + + +# 15:23:56 > +# 15:23:56 > "Done." +# 15:23:56 > + diff --git a/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.out b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.out --- a/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.out +++ b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.out @@ -0,0 +1,80 @@ +stdout of test 'filter_json_null.Bug-6773` in directory 'sql/test/BugTracker-2019` itself: + + +# 15:23:55 > +# 15:23:55 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=30124" "--set" "mapi_usock=/var/tmp/mtest-13615/.s.monetdb.30124" "--set" "monet_prompt=" "--forcemito" "--dbpath=/home/kutsurak/work/monet/sources/MonetDB/build/install/var/MonetDB/mTests_sql_test_BugTracker-2019" "--set" "embedded_c=true" +# 15:23:55 > + +# MonetDB 5 server v11.33.12 (hg id: 1306a067c8ad+) +# This is an unreleased version +# Serving database 'mTests_sql_test_BugTracker-2019', using 4 threads +# Compiled for x86_64-pc-linux-gnu/64bit with 128bit integers +# Found 15.511 GiB available main-memory. +# Copyright (c) 1993 - July 2008 CWI. +# Copyright (c) August 2008 - 2019 MonetDB B.V., all rights reserved +# Visit https://www.monetdb.org/ for further information +# Listening for connection requests on mapi:monetdb://zarquon.zarniwoop.org:30124/ +# Listening for UNIX domain connection requests
MonetDB: Nov2019 - Merge with Apr2019
Changeset: 170026ebc3dd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=170026ebc3dd Modified Files: sql/test/BugTracker-2019/Tests/All Branch: Nov2019 Log Message: Merge with Apr2019 diffs (8 lines): diff --git a/sql/test/BugTracker-2019/Tests/All b/sql/test/BugTracker-2019/Tests/All --- a/sql/test/BugTracker-2019/Tests/All +++ b/sql/test/BugTracker-2019/Tests/All @@ -39,3 +39,4 @@ select-char.Bug-6761 grant-select-column.Bug-6765 next-get-value-bulk.Bug-6766 KNOWNFAIL?filter_json_null.Bug-6773 +prod-decimals.Bug-6774 ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019
Changeset: 4c91c600f5e0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4c91c600f5e0 Added Files: sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.sql sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.err sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.out sql/test/BugTracker-2019/Tests/prod-decimals.Bug-6774.sql sql/test/BugTracker-2019/Tests/prod-decimals.Bug-6774.stable.err sql/test/BugTracker-2019/Tests/prod-decimals.Bug-6774.stable.out Modified Files: clients/mapiclient/mhelp.c sql/common/sql_types.c sql/test/BugTracker-2019/Tests/All sql/test/sys-schema/Tests/systemfunctions.stable.out sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 Branch: Nov2019 Log Message: Merge with Apr2019 diffs (truncated from 356 to 300 lines): diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c --- a/clients/mapiclient/mhelp.c +++ b/clients/mapiclient/mhelp.c @@ -513,7 +513,7 @@ SQLhelp sqlhelp1[] = { NULL}, {"UPDATE", "", -"[ WITH cte_list ] UPDATE qname [ [AS] ident ] SET assignment_list [ WHERE search_condition ]", +"[ WITH cte_list ] UPDATE qname [ [AS] ident ] SET assignment_list [ FROM from_item ] [ WHERE search_condition ]", "cte_list,assignment_list,search_condition", NULL}, {"VALUES", 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 @@ -1622,8 +1622,9 @@ sqltypeinit( sql_allocator *sa) if (HAVE_HGE) sql_create_aggr(sa, "prod", "aggr", "prod", HGE, LargestINT); #endif - /*sql_create_aggr(sa, "prod", "aggr", "prod", LNG, LNG);*/ +#if 0 + /* prod for decimals introduce errors in the output scales */ t = decimals; /* BTE */ sql_create_aggr(sa, "prod", "aggr", "prod", *(t), LargestDEC); t++; /* SHT */ @@ -1638,6 +1639,7 @@ sqltypeinit( sql_allocator *sa) sql_create_aggr(sa, "prod", "aggr", "prod", *(t), LargestDEC); } #endif +#endif for (t = numerical; t < dates; t++) { sql_create_func(sa, "mod", "calc", "%", *t, *t, *t, SCALE_FIX); @@ -1819,6 +1821,8 @@ sqltypeinit( sql_allocator *sa) sql_create_analytic(sa, "prod", "sql", "prod", HGE, LargestINT, SCALE_NONE); #endif +#if 0 + /* prod for decimals introduce errors in the output scales */ t = decimals; // BTE sql_create_analytic(sa, "prod", "sql", "prod", *(t), LargestDEC, SCALE_NONE); t++; // SHT @@ -1833,6 +1837,7 @@ sqltypeinit( sql_allocator *sa) sql_create_analytic(sa, "prod", "sql", "prod", *(t), LargestDEC, SCALE_NONE); } #endif +#endif for (t = floats; t < dates; t++) { sql_create_analytic(sa, "sum", "sql", "sum", *t, *t, SCALE_NONE); diff --git a/sql/test/BugTracker-2019/Tests/All b/sql/test/BugTracker-2019/Tests/All --- a/sql/test/BugTracker-2019/Tests/All +++ b/sql/test/BugTracker-2019/Tests/All @@ -38,3 +38,4 @@ HAVE_LIBPY3?python-loader-string.Bug-675 select-char.Bug-6761 grant-select-column.Bug-6765 next-get-value-bulk.Bug-6766 +KNOWNFAIL?filter_json_null.Bug-6773 diff --git a/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.sql b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.sql @@ -0,0 +1,2 @@ +select json.filter('{"foo": null}', '$.foo'); +select json.filter('[null]', '$.0'); diff --git a/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.err b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.err new file mode 100644 diff --git a/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.out b/sql/test/BugTracker-2019/Tests/filter_json_null.Bug-6773.stable.out new file mode 100644 diff --git a/sql/test/BugTracker-2019/Tests/prod-decimals.Bug-6774.sql b/sql/test/BugTracker-2019/Tests/prod-decimals.Bug-6774.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2019/Tests/prod-decimals.Bug-6774.sql @@ -0,0 +1,34 @@ +START TRANSACTION; + +CREATE TABLE "t1" ( + "a1" INTEGER, + "prob" DECIMAL(7,4) +); +INSERT INTO t1 VALUES (5, 0.2000); + +CREATE TABLE "t2" ( + "a1" INTEGER, + "prob" DECIMAL(7,4) +); +INSERT INTO t2 VALUES (5, 0.5000); + +CREATE TABLE "t3" ( + "a1" INTEGER, + "prob" TINYINT +); +INSERT INTO t3 VALUES (5, 1); + +SELECT tmp.a1, prod(tmp.prob) AS prob FROM +(SELECT a1, prob FROM +(SELECT t1.a1 AS a1, t3.a1 AS a2, t1.prob * t3.prob AS prob FROM t1,t3 WHERE t1.a1 = t3.a1) AS t__x30 + UNION ALL + SELECT a1, prob FROM (SELECT t2.a1 AS a1, t3.a1 AS a2, t2.prob * t3.prob AS prob FROM t2,t3 WHERE t2.a1 = t3.a1) AS t__x32) as tmp +GROUP BY tmp.a1; + +select prod(col1) from
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: 2c3127fd4002 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2c3127fd4002 Modified Files: gdk/gdk_utils.c Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (111 lines): diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c --- a/gdk/gdk_utils.c +++ b/gdk/gdk_utils.c @@ -402,39 +402,76 @@ MT_init(void) # error "don't know how to get the amount of physical memory for your OS" #endif -#ifndef WIN32 +#ifdef __linux__ /* limit values to whatever cgroups gives us */ - FILE *f; - /* limit of memory usage */ - f = fopen("/sys/fs/cgroup/memory/memory.limit_in_bytes", "r"); - if (f != NULL) { - uint64_t mem; - if (fscanf(f, "%" SCNu64, ) == 1 - && mem < (uint64_t) _MT_pagesize * _MT_npages) { - _MT_npages = (size_t) (mem / _MT_pagesize); + FILE *fc; + fc = fopen("/proc/self/cgroup", "r"); + if (fc != NULL) { + char buf[1024]; + while (fgets(buf, (int) sizeof(buf), fc) != NULL) { + char *p, *q; + p = strchr(buf, ':'); + if (p == NULL) + break; + q = p + 1; + p = strchr(q, ':'); + if (p == NULL) + break; + *p++ = 0; + if (strstr(q, "memory") != NULL) { + char pth[1024]; + FILE *f; + q = strchr(p, '\n'); + if (q == NULL) + break; + *q = 0; + q = stpconcat(pth, "/sys/fs/cgroup/memory", + p, NULL); + /* sometimes the path in +* /proc/self/cgroup ends in "/" (or +* actually, is "/"); in all other +* cases add one */ + if (q[-1] != '/') + *q++ = '/'; + /* limit of memory usage */ + strcpy(q, "memory.limit_in_bytes"); + f = fopen(pth, "r"); + if (f != NULL) { + uint64_t mem; + if (fscanf(f, "%" SCNu64, ) == 1 + && mem < (uint64_t) _MT_pagesize * _MT_npages) { + _MT_npages = (size_t) (mem / _MT_pagesize); + } + fclose(f); + } + /* soft limit of memory usage */ + strcpy(q, "memory.soft_limit_in_bytes"); + f = fopen(pth, "r"); + if (f != NULL) { + uint64_t mem; + if (fscanf(f, "%" SCNu64, ) == 1 + && mem < (uint64_t) _MT_pagesize * _MT_npages) { + _MT_npages = (size_t) (mem / _MT_pagesize); + } + fclose(f); + } + /* limit of memory+swap usage +* we use this as maximum virtual memory size */ + strcpy(q, "memory.memsw.limit_in_bytes"); + f = fopen(pth, "r"); + if (f != NULL) { + uint64_t mem; + if (fscanf(f, "%" SCNu64, ) == 1 + && mem < (uint64_t) GDK_vm_maxsize) { + GDK_vm_maxsize = (size_t) mem; + } + fclose(f); + } + break; + + } } - fclose(f); - } - /* soft limit of memory usage */ - f = fopen("/sys/fs/cgroup/memory/memory.soft_limit_in_bytes", "r"); - if (f != NULL) { - uint64_t mem; - if (fscanf(f, "%" SCNu64, ) == 1 - && mem < (uint64_t) _MT_pagesize * _MT_npages) { - _MT_npages = (size_t) (mem / _MT_pagesize); - } - fclose(f); - } - /* limit of memory+swap usage -* we use this as maximum virtual memory size */ - f =
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: dc11658ef98d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dc11658ef98d Modified Files: configure.ag sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (32 lines): diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -1666,12 +1666,22 @@ AS_VAR_IF([enable_rintegration], [no], [ enable_rintegration=no why_not_rintegration="(libR library not found)"])], [AS_IF([RHOME=`$RCMD RHOME` && libr_CFLAGS=`$RCMD CMD config --cppflags` && libr_LIBS=`$RCMD CMD config --ldflags | sed -e 's|-fopenmp |-fopenmp=libgomp |'`], - [have_libr=yes -AC_DEFINE([HAVE_LIBR], 1, [Define if you have libR installed]) -AC_SUBST([libr_CFLAGS], [$libr_CFLAGS]) -AC_SUBST([libr_LIBS], [$libr_LIBS]) -AC_SUBST([RHOME], [$RHOME]) -AC_DEFINE_UNQUOTED([RHOME], ["$RHOME"], [The home of R])])])]) + [save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $libr_CFLAGS" +AC_CHECK_HEADER([Rembedded.h], + [have_libr=yes +AC_DEFINE([HAVE_LIBR], 1, [Define if you have libR installed]) +AC_SUBST([libr_CFLAGS], [$libr_CFLAGS]) +AC_SUBST([libr_LIBS], [$libr_LIBS]) +AC_SUBST([RHOME], [$RHOME]) +AC_DEFINE_UNQUOTED([RHOME], ["$RHOME"], [The home of R])], + [AS_VAR_IF([enable_rintegration], [yes], + [AC_MSG_ERROR([libR library required for R integration support])], + [have_libr=no +why_not_libr="(Rembedded.h not found)" +enable_rintegration=no +why_not_rintegration="(Rembedded.h not found)"])]) +CPPFLAGS="$save_CPPFLAGS"])])]) AM_CONDITIONAL([HAVE_LIBR], [test x"$have_libr" != xno]) # Python API (Python UDFs) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019
Changeset: f781975f23d0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f781975f23d0 Modified Files: sql/backends/monet5/sql_rank.c sql/test/analytics/Tests/analytics01.sql sql/test/analytics/Tests/analytics01.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 diffs (116 lines): diff --git a/sql/backends/monet5/sql_rank.c b/sql/backends/monet5/sql_rank.c --- a/sql/backends/monet5/sql_rank.c +++ b/sql/backends/monet5/sql_rank.c @@ -996,19 +996,25 @@ SQLnth_value(Client cntxt, MalBlkPtr mb, return MAL_SUCCEED; } -#define CHECK_L_VALUE(TPE) \ - do { \ - TPE rval = *getArgReference_##TPE(stk, pci, 2); \ - l_value = is_##TPE##_nil(rval) ? BUN_NONE : (rval > 0 ? (BUN)rval : (BUN)(-1 * rval)); \ +#define CHECK_L_VALUE(TPE) \ + do { \ + TPE rval = *getArgReference_##TPE(stk, pci, 2); \ + if (!is_##TPE##_nil(rval) && rval < 0) { \ + gdk_call = dual; \ + rval *= -1; \ + } \ + l_value = is_##TPE##_nil(rval) ? BUN_NONE : (BUN)rval; \ } while(0); -static str /* the variable m is used to fix the multiplier */ +static str do_lead_lag(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, const char* op, const char* desc, - gdk_return (*func)(BAT *, BAT *, BAT *, BUN, const void* restrict, int)) + gdk_return (*func)(BAT *, BAT *, BAT *, BUN, const void* restrict, int), + gdk_return (*dual)(BAT *, BAT *, BAT *, BUN, const void* restrict, int)) { int tp1, tp2, tp3, base = 2; BUN l_value = 1; const void *restrict default_value; + gdk_return (*gdk_call)(BAT *, BAT *, BAT *, BUN, const void* restrict, int) = func; (void)cntxt; if (pci->argc < 4 || pci->argc > 6) @@ -1079,11 +1085,11 @@ do_lead_lag(Client cntxt, MalBlkPtr mb, } } - gdk_code = func(r, b, p, l_value, default_value, tp1); + gdk_code = gdk_call(r, b, p, l_value, default_value, tp1); BATsetcount(r, cnt); BBPunfix(b->batCacheid); - if(gdk_code == GDK_SUCCEED) + if (gdk_code == GDK_SUCCEED) BBPkeepref(*res = r->batCacheid); else throw(SQL, op, GDK_EXCEPTION); @@ -1103,13 +1109,13 @@ do_lead_lag(Client cntxt, MalBlkPtr mb, str SQLlag(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { - return do_lead_lag(cntxt, mb, stk, pci, "sql.lag", "lag", GDKanalyticallag); + return do_lead_lag(cntxt, mb, stk, pci, "sql.lag", "lag", GDKanalyticallag, GDKanalyticallead); } str SQLlead(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci) { - return do_lead_lag(cntxt, mb, stk, pci, "sql.lead", "lead", GDKanalyticallead); + return do_lead_lag(cntxt, mb, stk, pci, "sql.lead", "lead", GDKanalyticallead, GDKanalyticallag); } /* we will keep the ordering bat here although is not needed, but maybe later with varied sized windows */ diff --git a/sql/test/analytics/Tests/analytics01.sql b/sql/test/analytics/Tests/analytics01.sql --- a/sql/test/analytics/Tests/analytics01.sql +++ b/sql/test/analytics/Tests/analytics01.sql @@ -211,6 +211,9 @@ create table t1 (col1 int, col2 int); insert into t1 values (8481, 0), (8489, 0), (8489, 1), (8498, 0), (8498, 1), (8498, 2), (8507, 0), (8507, 1), (8507, 2); select col1, col2, lag(col2) over (partition by col1 ORDER BY col2), lag(col2, 2) over (partition by col1 ORDER BY col2), lag(col2, 3) over (partition by col1 ORDER BY col2) from t1; +select lag(col2, -1) over (partition by col1 ORDER BY col2), lag(col2, 1) over (partition by col1 ORDER BY col2), lag(col2, 2) over (partition by col1 ORDER BY col2) from t1; +select lead(col2, -1) over (partition by col1 ORDER BY col2), lead(col2, 1) over (partition by col1 ORDER BY col2), lead(col2, 2) over (partition by col1 ORDER BY col2) from t1; + rollback; select ntile(aa) over () from analytics; --error diff --git a/sql/test/analytics/Tests/analytics01.stable.out b/sql/test/analytics/Tests/analytics01.stable.out --- a/sql/test/analytics/Tests/analytics01.stable.out +++ b/sql/test/analytics/Tests/analytics01.stable.out @@ -2522,6 +2522,34 @@ stdout of test 'analytics01` in director [ 8507,0, NULL, NULL, NULL] [ 8507,1, 0, NULL, NULL] [ 8507,2, 1, 0, NULL] +#select lag(col2, -1) over (partition by col1 ORDER BY col2), lag(col2, 1) over (partition by col1 ORDER BY col2), lag(col2, 2) over (partition by col1 ORDER BY col2) from t1; +% sys.L3,
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: f334c13c7a23 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f334c13c7a23 Modified Files: gdk/gdk_analytic_func.c sql/test/analytics/Tests/analytics01.sql sql/test/analytics/Tests/analytics01.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (truncated from 1916 to 300 lines): diff --git a/gdk/gdk_analytic_func.c b/gdk/gdk_analytic_func.c --- a/gdk/gdk_analytic_func.c +++ b/gdk/gdk_analytic_func.c @@ -585,7 +585,7 @@ GDKanalyticalnthvalue(BAT *r, BAT *b, BA #define ANALYTICAL_LAG_IMP(TPE) \ do {\ - TPE *rp, *rb, *bp, *rend, \ + TPE *rp, *rb, *bp, *nbp, *rend, \ def = *((TPE *) default_value), next; \ bp = (TPE*)Tloc(b, 0); \ rb = rp = (TPE*)Tloc(r, 0); \ @@ -601,8 +601,9 @@ GDKanalyticalnthvalue(BAT *r, BAT *b, BA if (*np) { \ ncnt = (np - pnp); \ rp += ncnt; \ + nbp = bp + ncnt; \ ANALYTICAL_LAG_CALC(TPE); \ - bp += (lag < ncnt) ? lag : 0; \ + bp = nbp; \ pnp = np; \ } \ } \ diff --git a/sql/test/analytics/Tests/analytics01.sql b/sql/test/analytics/Tests/analytics01.sql --- a/sql/test/analytics/Tests/analytics01.sql +++ b/sql/test/analytics/Tests/analytics01.sql @@ -207,6 +207,10 @@ select aa, bb, lead(aa, 2, 100) over (pa select nth_value(aa, aa) over () from analytics; select nth_value(1, aa) over () from analytics; +create table t1 (col1 int, col2 int); +insert into t1 values (8481, 0), (8489, 0), (8489, 1), (8498, 0), (8498, 1), (8498, 2), (8507, 0), (8507, 1), (8507, 2); +select col1, col2, lag(col2) over (partition by col1 ORDER BY col2), lag(col2, 2) over (partition by col1 ORDER BY col2), lag(col2, 3) over (partition by col1 ORDER BY col2) from t1; + rollback; select ntile(aa) over () from analytics; --error diff --git a/sql/test/analytics/Tests/analytics01.stable.out b/sql/test/analytics/Tests/analytics01.stable.out --- a/sql/test/analytics/Tests/analytics01.stable.out +++ b/sql/test/analytics/Tests/analytics01.stable.out @@ -28,8 +28,8 @@ stdout of test 'analytics01` in director [ 10 ] #start transaction; #select percent_rank() over (partition by aa) from analytics; -% sys.L4 # table_name -% L4 # name +% sys.L3 # table_name +% L3 # name % double # type % 24 # length [ 0] @@ -43,8 +43,8 @@ stdout of test 'analytics01` in director [ 0] [ 0] #select percent_rank() over (partition by aa order by aa asc) from analytics; -% sys.L4 # table_name -% L4 # name +% sys.L3 # table_name +% L3 # name % double # type % 24 # length [ 0] @@ -58,8 +58,8 @@ stdout of test 'analytics01` in director [ 0] [ 0] #select percent_rank() over (partition by aa order by aa desc) from analytics; -% sys.L4 # table_name -% L4 # name +% sys.L3 # table_name +% L3 # name % double # type % 24 # length [ 0] @@ -73,8 +73,8 @@ stdout of test 'analytics01` in director [ 0] [ 0] #select percent_rank() over (order by aa) from analytics; -% sys.L4 # table_name -% L4 # name +% sys.L3 # table_name +% L3 # name % double # type % 24 # length [ 0] @@ -88,8 +88,8 @@ stdout of test 'analytics01` in director [ 0.89 ] [ 1] #select percent_rank() over (order by aa desc) from analytics; -% sys.L4 # table_name -% L4 # name +% sys.L3 # table_name +% L3 # name % double # type % 24 # length [ 0] @@ -103,8 +103,8 @@ stdout of test 'analytics01` in director [ 0.89 ] [ 0.89 ] #select percent_rank() over (partition by bb) from analytics; -% sys.L4 # table_name -% L4 # name +% sys.L3 # table_name +% L3 # name % double # type % 24 # length [ 0] @@ -118,8 +118,8 @@ stdout of test 'analytics01` in director [ 0] [ 0] #select percent_rank() over (partition by bb order by bb asc) from analytics; -% sys.L4 # table_name -% L4 # name +% sys.L3 # table_name +% L3 # name % double # type % 24 # length [ 0] @@ -133,8 +133,8 @@ stdout of test 'analytics01` in director [ 0] [ 0] #select percent_rank() over (partition by bb order by bb desc) from analytics; -% sys.L4 # table_name -% L4 # name +% sys.L3 # table_name +% L3 # name % double # type % 24 # length [ 0] @@ -148,8 +148,8 @@
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: ee200eb4a7cd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ee200eb4a7cd Added Files: sql/test/miscellaneous/Tests/alter_table_add_column.sql sql/test/miscellaneous/Tests/alter_table_add_column.stable.err sql/test/miscellaneous/Tests/alter_table_add_column.stable.out Modified Files: sql/storage/store.c sql/test/miscellaneous/Tests/All Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (234 lines): diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -5871,8 +5871,28 @@ sql_trans_rename_column(sql_trans *tr, s int sql_trans_drop_column(sql_trans *tr, sql_table *t, sqlid id, int drop_action) { - node *n = list_find_base_id(t->columns.set, id); - sql_column *col = n->data; + node *n = NULL; + sql_table *syscolumn = find_sql_table(find_sql_schema(tr, "sys"), "_columns"); + sql_column *col = NULL, *cid = find_sql_column(syscolumn, "id"), *cnr = find_sql_column(syscolumn, "number"); + + for (node *nn = t->columns.set->h ; nn ; nn = nn->next) { + sql_column *next = (sql_column *) nn->data; + if (next->base.id == id) { + n = nn; + col = next; + } else if (col) { /* if the column to be dropped was found, decrease the column number for others after it */ + oid rid; + next->colnr--; + + rid = table_funcs.column_find_row(tr, cid, >base.id, NULL); + assert(!is_oid_nil(rid)); + table_funcs.column_update_value(tr, cnr, rid, >colnr); + + next->base.wtime = tr->wtime = tr->wstime; + } + } + + assert(n && col); /* the column to be dropped must have been found */ if (drop_action == DROP_CASCADE_START || drop_action == DROP_CASCADE) { sqlid *local_id = MNEW(sqlid); diff --git a/sql/test/miscellaneous/Tests/All b/sql/test/miscellaneous/Tests/All --- a/sql/test/miscellaneous/Tests/All +++ b/sql/test/miscellaneous/Tests/All @@ -8,3 +8,4 @@ groupby_expressions values with_update_stmts groupby_error +alter_table_add_column diff --git a/sql/test/miscellaneous/Tests/alter_table_add_column.sql b/sql/test/miscellaneous/Tests/alter_table_add_column.sql new file mode 100644 --- /dev/null +++ b/sql/test/miscellaneous/Tests/alter_table_add_column.sql @@ -0,0 +1,26 @@ +START TRANSACTION; + +CREATE SCHEMA "snctest"; +CREATE TABLE "snctest"."u_table" ("sys_id" CHAR(32)); +INSERT INTO "snctest"."u_table" VALUES (NULL); +SELECT * FROM "snctest"."u_table"; + +ALTER TABLE "snctest"."u_table" ADD "u_flat_string" varchar(40); +ALTER TABLE "snctest"."u_table" ADD "sysc_u_flat_string" varchar(40); +ALTER TABLE "snctest"."u_table" ADD "u_flat_moved" varchar(40); +ALTER TABLE "snctest"."u_table" ADD "sysc_u_flat_moved" varchar(40); +ALTER TABLE "snctest"."u_table" DROP "u_flat_string"; +ALTER TABLE "snctest"."u_table" DROP "sysc_u_flat_string"; +ALTER TABLE "snctest"."u_table" ADD "u_flat_string" varchar(40); +ALTER TABLE "snctest"."u_table" ADD "sysc_u_flat_string" varchar(40); + +SELECT * FROM "snctest"."u_table"; + +SELECT Columns.number, Columns.name, Columns.type, Columns.type_scale FROM sys.columns as Columns +WHERE Columns.table_id = (SELECT Tables.id FROM sys.tables as Tables + WHERE Tables.schema_id = (SELECT Schema.id FROM sys.schemas as Schema WHERE Schema.name = 'snctest') AND Tables.name = 'u_table') +ORDER BY Columns.number; + +SELECT * FROM "snctest"."u_table"; + +ROLLBACK; diff --git a/sql/test/miscellaneous/Tests/alter_table_add_column.stable.err b/sql/test/miscellaneous/Tests/alter_table_add_column.stable.err new file mode 100644 --- /dev/null +++ b/sql/test/miscellaneous/Tests/alter_table_add_column.stable.err @@ -0,0 +1,35 @@ +stderr of test 'alter_table_add_column` in directory 'sql/test/miscellaneous` itself: + + +# 09:54:48 > +# 09:54:48 > "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" "mapi_open=true" "--set" "mapi_port=34303" "--set" "mapi_usock=/var/tmp/mtest-15192/.s.monetdb.34303" "--set" "monet_prompt=" "--forcemito" "--dbpath=/home/ferreira/repositories/MonetDB-Apr2019/BUILD/var/MonetDB/mTests_sql_test_miscellaneous" "--set" "embedded_r=yes" "--set" "embedded_py=2" "--set" "embedded_c=true" +# 09:54:48 > + +# builtin opt gdk_dbpath = /home/ferreira/repositories/MonetDB-Apr2019/BUILD/var/monetdb5/dbfarm/demo +# builtin opt monet_prompt = > +# builtin opt monet_daemon = no +# builtin opt mapi_port = 5 +# builtin opt mapi_open = false +# builtin opt mapi_autosense = false +# builtin opt sql_optimizer = default_pipe +# builtin opt sql_debug = 0 +# cmdline opt gdk_nr_threads = 0 +# cmdline opt mapi_open = true +# cmdline opt mapi_port = 34303 +# cmdline opt mapi_usock =
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: b254bc20bdc0 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b254bc20bdc0 Modified Files: tools/merovingian/daemon/handlers.c tools/merovingian/daemon/merovingian.c tools/merovingian/daemon/merovingian.h Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (44 lines): diff --git a/tools/merovingian/daemon/handlers.c b/tools/merovingian/daemon/handlers.c --- a/tools/merovingian/daemon/handlers.c +++ b/tools/merovingian/daemon/handlers.c @@ -79,7 +79,7 @@ handler(int sig) /* we're not using a lock for setting, reading and clearing this flag * (deadlock!), but we should use atomic instructions */ -static volatile int hupflag = 0; +static volatile sig_atomic_t hupflag = 0; /** * Handler for SIGHUP, causes a re-read of the .merovingian_properties diff --git a/tools/merovingian/daemon/merovingian.c b/tools/merovingian/daemon/merovingian.c --- a/tools/merovingian/daemon/merovingian.c +++ b/tools/merovingian/daemon/merovingian.c @@ -106,7 +106,7 @@ pthread_mutex_t _mero_topdp_lock = PTHRE /* for the logger, when set to 0, the logger terminates */ volatile int _mero_keep_logging = 1; /* for accepting connections, when set to 0, listening socket terminates */ -volatile char _mero_keep_listening = 1; +volatile sig_atomic_t _mero_keep_listening = 1; /* stream to where to write the log */ FILE *_mero_logfile = NULL; /* stream to the stdout for the neighbour discovery service */ diff --git a/tools/merovingian/daemon/merovingian.h b/tools/merovingian/daemon/merovingian.h --- a/tools/merovingian/daemon/merovingian.h +++ b/tools/merovingian/daemon/merovingian.h @@ -11,6 +11,7 @@ #include /* struct sockaddr_in */ #include /* pthread_mutex_t */ +#include /* sig_atomic_t */ #include "utils/utils.h" /* confkeyval */ @@ -65,7 +66,7 @@ extern char *_mero_mserver; extern dpair _mero_topdp; extern pthread_mutex_t _mero_topdp_lock; extern volatile int _mero_keep_logging; -extern volatile char _mero_keep_listening; +extern volatile sig_atomic_t _mero_keep_listening; extern FILE *_mero_logfile; extern unsigned short _mero_port; extern FILE *_mero_discout; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: 37bd7e2315ad for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=37bd7e2315ad Modified Files: sql/server/sql_privileges.c sql/server/sql_privileges.h sql/test/LSST/Tests/dbQuery036.stable.err sql/test/Tests/marcin3.stable.err Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (79 lines): diff --git a/sql/server/sql_privileges.c b/sql/server/sql_privileges.c --- a/sql/server/sql_privileges.c +++ b/sql/server/sql_privileges.c @@ -466,6 +466,25 @@ table_privs(mvc *m, sql_table *t, int pr } int +column_privs(mvc *m, sql_column *c, int priv) +{ + /* only SELECT and UPDATE privileges for columns are available */ + /* temporary tables are owned by the session user, so does it's columns */ + if (c->t->persistence == SQL_DECLARED_TABLE || + (!c->t->system && c->t->persistence != SQL_PERSIST) || + (priv == PRIV_SELECT && (c->t->persistence != SQL_PERSIST || c->t->commit_action))) + return 1; + if (admin_privs(m->user_id) || admin_privs(m->role_id) || + (c->t->s && (m->user_id == c->t->s->auth_id || m->role_id == c->t->s->auth_id)) || + sql_privilege(m, m->user_id, c->base.id, priv, 0) == priv || + sql_privilege(m, m->role_id, c->base.id, priv, 0) == priv || + sql_privilege(m, ROLE_PUBLIC, c->base.id, priv, 0) == priv) { + return 1; + } + return 0; +} + +int execute_priv(mvc *m, sql_func *f) { int priv = PRIV_EXECUTE; @@ -827,7 +846,6 @@ sql_rename_user(mvc *sql, char *olduser, if (backend_rename_user(sql, olduser, newuser) == FALSE) throw(SQL,"sql.rename_user", SQLSTATE(M1M05) "%s", sql->errstr); return NULL; - } int diff --git a/sql/server/sql_privileges.h b/sql/server/sql_privileges.h --- a/sql/server/sql_privileges.h +++ b/sql/server/sql_privileges.h @@ -26,7 +26,7 @@ extern int mvc_set_schema(mvc *m, char * extern int global_privs(mvc *m, int privs); extern int mvc_schema_privs(mvc *m, sql_schema *t); extern int table_privs(mvc *m, sql_table *t, int privs); - +extern int column_privs(mvc *m, sql_column *c, int privs); extern int execute_priv(mvc *m, sql_func *f); extern int sql_privilege(mvc *m, sqlid auth_id, sqlid obj_id, int privs, int sub); @@ -45,4 +45,5 @@ extern char * sql_create_user(mvc *sql, extern char * sql_drop_user(mvc *sql, char *user); extern char * sql_alter_user(mvc *sql, char *user, char *passwd, char enc, char *schema, char *oldpasswd); extern char * sql_rename_user(mvc *sql, char *olduser, char *newuser); + #endif /*_SQL_PRIV_H_ */ diff --git a/sql/test/LSST/Tests/dbQuery036.stable.err b/sql/test/LSST/Tests/dbQuery036.stable.err --- a/sql/test/LSST/Tests/dbQuery036.stable.err +++ b/sql/test/LSST/Tests/dbQuery036.stable.err @@ -85,7 +85,7 @@ QUERY = SELECT ROUND(uMag-gMag,0) AS UG AND (uMag+gMag+rMag+iMag+zMag+yMag) < 150 -- exclude bogus magnitudes (== 999) GROUP BY UG, GR, RI, IZ, ZY HAVING pop > 500-- Common bucktes have 500 or more members, so delete them -ERROR = !SELECT: cannot use non GROUP BY column 'pop' in query results without an aggregate function +ERROR = !SELECT: identifier 'pop' unknown CODE = 42000 # 05:57:35 > diff --git a/sql/test/Tests/marcin3.stable.err b/sql/test/Tests/marcin3.stable.err --- a/sql/test/Tests/marcin3.stable.err +++ b/sql/test/Tests/marcin3.stable.err @@ -21,7 +21,7 @@ ERROR = !SELECT: cannot use non GROUP BY CODE = 42000 MAPI = (monetdb) /var/tmp/mtest-26937/.s.monetdb.35713 QUERY = select id, cast(sum(val) as bigint) AS valsum from nutki group by id having valsum>3; -ERROR = !SELECT: cannot use non GROUP BY column 'valsum' in query results without an aggregate function +ERROR = !SELECT: identifier 'valsum' unknown CODE = 42000 # 21:15:41 > ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: 8b32b005db53 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8b32b005db53 Added Files: sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.py sql/test/BugTracker-2019/Tests/next-get-value-bulk.Bug-6766.sql sql/test/BugTracker-2019/Tests/next-get-value-bulk.Bug-6766.stable.out sql/test/miscellaneous/Tests/groupby_error.sql sql/test/miscellaneous/Tests/groupby_error.stable.err sql/test/miscellaneous/Tests/groupby_error.stable.out Modified Files: sql/server/rel_select.c sql/test/BugTracker-2019/Tests/All sql/test/miscellaneous/Tests/All Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (truncated from 350 to 300 lines): diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -1062,16 +1062,16 @@ rel_column_ref(sql_query *query, sql_rel return rel_var_ref(sql, name, 0); } if (!exp && !var) { - if (rel && *rel && (*rel)->card <= CARD_AGGR && is_sql_sel(f) && !is_sql_aggr(f)) { + if (rel && *rel && (*rel)->card <= CARD_AGGR && !is_sql_aggr(f) && (is_sql_sel(f) || is_sql_having(f))) { sql_rel *gb = *rel; - while(gb->l && !is_groupby(gb->op)) + while (gb->l && !is_groupby(gb->op)) + gb = gb->l; + if (gb && is_select(gb->op)) /* check for having clause generated selection */ gb = gb->l; if (gb && gb->l && rel_bind_column(sql, gb->l, name, f)) return sql_error(sql, 05, SQLSTATE(42000) "SELECT: cannot use non GROUP BY column '%s' in query results without an aggregate function", name); } - if (is_sql_having(f)) - return sql_error(sql, 05, SQLSTATE(42000) "SELECT: cannot use non GROUP BY column '%s' in query results without an aggregate function", name); return sql_error(sql, 02, SQLSTATE(42000) "SELECT: identifier '%s' unknown", name); } if (exp && rel && *rel && (*rel)->card <= CARD_AGGR && exp->card > CARD_AGGR && is_sql_sel(f) && !is_sql_aggr(f)) { @@ -1112,16 +1112,16 @@ rel_column_ref(sql_query *query, sql_rel } } if (!exp) { - if (rel && *rel && (*rel)->card == CARD_AGGR && is_sql_sel(f) && !is_sql_aggr(f)) { + if (rel && *rel && (*rel)->card == CARD_AGGR && !is_sql_aggr(f) && (is_sql_sel(f) || is_sql_having(f))) { sql_rel *gb = *rel; - while(gb->l && !is_groupby(gb->op) && is_project(gb->op)) + while (gb->l && !is_groupby(gb->op) && is_project(gb->op)) + gb = gb->l; + if (gb && is_select(gb->op)) /* check for having clause generated selection */ gb = gb->l; if (gb && is_groupby(gb->op) && gb->l && rel_bind_column2(sql, gb->l, tname, cname, f)) return sql_error(sql, 05, SQLSTATE(42000) "SELECT: cannot use non GROUP BY column '%s.%s' in query results without an aggregate function", tname, cname); } - if (is_sql_having(f)) - return sql_error(sql, 05, SQLSTATE(42S22) "SELECT: cannot use non GROUP BY column '%s.%s' in query results without an aggregate function", tname, cname); return sql_error(sql, 02, SQLSTATE(42S22) "SELECT: no such column '%s.%s'", tname, cname); } if (exp && rel && *rel && (*rel)->card == CARD_AGGR && exp->card > CARD_AGGR && is_sql_sel(f) && !is_sql_aggr(f)) { diff --git a/sql/test/BugTracker-2019/Tests/All b/sql/test/BugTracker-2019/Tests/All --- a/sql/test/BugTracker-2019/Tests/All +++ b/sql/test/BugTracker-2019/Tests/All @@ -36,3 +36,5 @@ merge-table-limit.Bug-6756 double-free.Bug-6757 HAVE_LIBPY3?python-loader-string.Bug-6759 select-char.Bug-6761 +grant-select-column.Bug-6765 +next-get-value-bulk.Bug-6766 diff --git a/sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.py b/sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.py new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2019/Tests/grant-select-column.Bug-6765.py @@ -0,0 +1,48 @@ +import os +import sys + +try: +from MonetDBtesting import process +except ImportError: +import process + + +def client(next_user, next_passwd, input): +c = process.client('sql', user=next_user,
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: 9b90cd14fb1d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9b90cd14fb1d Modified Files: sql/backends/monet5/rel_bin.c sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.sql sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out sql/test/BugTracker-2019/Tests/view-where-cast-error.Bug-6712.stable.err sql/test/BugTracker-2019/Tests/view-where-cast-error.Bug-6712.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (76 lines): diff --git a/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.sql b/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.sql --- a/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.sql +++ b/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.sql @@ -2,16 +2,16 @@ DELETE FROM sys.statistics; -- fill sys.statistics ANALYZE sys.statistics; -SELECT /*column_id,*/ type, width, /*stamp,*/ "sample", count, "unique", nils, /*minval,*/ /*maxval,*/ sorted, revsorted FROM sys.statistics ORDER BY column_id; +SELECT /*column_id,*/ "type", width, /*stamp,*/ "sample", "count", "unique", nils, /*minval,*/ /*maxval,*/ sorted, revsorted FROM sys.statistics WHERE "type" <> 'timestamp' ORDER BY column_id; -- update the values of: sample, count, unique, nils, minval, maxval, sorted, revsorted of sys.statistics ANALYZE sys.statistics; -SELECT /*column_id,*/ type, width, /*stamp,*/ "sample", count, "unique", nils, /*minval,*/ /*maxval,*/ sorted, revsorted FROM sys.statistics ORDER BY column_id; +SELECT /*column_id,*/ "type", width, /*stamp,*/ "sample", "count", "unique", nils, /*minval,*/ /*maxval,*/ sorted, revsorted FROM sys.statistics WHERE "type" <> 'timestamp' ORDER BY column_id; -- ALTER TABLE sys.statistics SET READ ONLY; CREATE ORDERED INDEX stat_oidx ON sys.statistics (width); -SELECT /*column_id,*/ type, width, /*stamp,*/ "sample", count, "unique", nils, /*minval,*/ /*maxval,*/ sorted, revsorted FROM sys.statistics ORDER BY column_id; +SELECT /*column_id,*/ "type", width, /*stamp,*/ "sample", "count", "unique", nils, /*minval,*/ /*maxval,*/ sorted, revsorted FROM sys.statistics WHERE "type" <> 'timestamp' ORDER BY column_id; -- now mserver5 is crashed !! -- ALTER TABLE sys.statistics SET READ WRITE; diff --git a/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out b/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out --- a/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out +++ b/sql/test/BugTracker-2017/Tests/crash_after_oidx_on_sys_statistics.Bug-6251.stable.out @@ -16,10 +16,6 @@ stdout of test 'crash_after_oidx_on_sys_ # Listening for connection requests on mapi:monetdb://toulouse.da.cwi.nl:32740/ # Listening for UNIX domain connection requests on mapi:monetdb:///var/tmp/mtest-1294/.s.monetdb.32740 # MonetDB/GIS module loaded -# MonetDB/SQL module loaded -# MonetDB/Python module loaded -# MonetDB/R module loaded - # SQL catalog created, loading sql scripts once # loading sql script: 09_like.sql # loading sql script: 10_math.sql @@ -71,11 +67,10 @@ stdout of test 'crash_after_oidx_on_sys_ % sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics # table_name % type,width, sample, count, unique, nils, sorted, revsorted # name % clob,int,bigint, bigint, bigint, bigint, boolean,boolean # type -% 9, 1, 1, 1, 1, 1, 5, 5 # length +% 7, 1, 1, 1, 1, 1, 5, 5 # length [ "int", 4, 0, 0, 0, 0, true, true] [ "clob", 1, 0, 0, 0, 0, true, true] [ "int", 4, 0, 0, 0, 0, true, true] -[ "timestamp", 8, 0, 0, 0, 0, true, true] [ "bigint",8, 0, 0, 0, 0, true, true] [ "bigint",8, 0, 0, 0, 0, true, true] [ "bigint",8, 0, 0, 0, 0, true, true] @@ -88,11 +83,10 @@ stdout of test 'crash_after_oidx_on_sys_ % sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics, sys.statistics # table_name % type,width, sample, count, unique, nils, sorted, revsorted # name % clob,int,bigint, bigint, bigint, bigint, boolean,boolean # type -% 9, 1, 2, 2, 2, 2, 5, 5 # length +% 7, 1, 2, 2, 2, 2, 5, 5 # length [ "int", 4, 12, 12, 12, 0, true, false ] [ "clob", 1, 12, 12, 5, 0, false, false ] [ "int",
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: a34463b67c84 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a34463b67c84 Modified Files: NT/mkodbcwxs.py NT/mksqlwxs.py sql/test/pg_regress/Tests/interval.stable.err sql/test/pg_regress/Tests/interval.stable.err.int128 sql/test/pg_regress/Tests/interval.stable.out sql/test/pg_regress/Tests/interval.stable.out.int128 sql/test/pg_regress/Tests/timestamp.sql sql/test/pg_regress/Tests/timestamptz.sql sql/test/sys-schema/Tests/systemfunctions.stable.out sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (184 lines): diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py --- a/NT/mkodbcwxs.py +++ b/NT/mkodbcwxs.py @@ -55,8 +55,8 @@ def main(): print(r'') print(r'') print(r'') -if vs == '17': -msvc = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC' +if vs in ('17', '19'): +msvc = r'C:\Program Files (x86)\Microsoft Visual Studio\20%s\Community\VC\Redist\MSVC' % vs d = sorted(os.listdir(msvc))[-1] msm = '_CRT_%s.msm' % arch for f in sorted(os.listdir(os.path.join(msvc, d, 'MergeModules'))): diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -114,8 +114,8 @@ def main(): print(r'') print(r'') print(r'') -if vs == '17': -msvc = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC' +if vs in ('17', '19'): +msvc = r'C:\Program Files (x86)\Microsoft Visual Studio\20%s\Community\VC\Redist\MSVC' % vs d = sorted(os.listdir(msvc))[-1] msm = '_CRT_%s.msm' % arch for f in sorted(os.listdir(os.path.join(msvc, d, 'MergeModules'))): diff --git a/sql/test/pg_regress/Tests/interval.stable.err b/sql/test/pg_regress/Tests/interval.stable.err --- a/sql/test/pg_regress/Tests/interval.stable.err +++ b/sql/test/pg_regress/Tests/interval.stable.err @@ -145,10 +145,6 @@ QUERY = SELECT '' AS nine, INTERVAL_TBL. ERROR = !Wrong format (@ 3 seconds ago) CODE = 42000 MAPI = (monetdb) /var/tmp/mtest-3604/.s.monetdb.35433 -QUERY = select avg(f1) from interval_tbl; -ERROR = !types sec_interval(13,0) and double(53,0) are not equal for column 'f1' -CODE = 42000 -MAPI = (monetdb) /var/tmp/mtest-3604/.s.monetdb.35433 QUERY = select avg(cast(f1 as double)) from interval_tbl; ERROR = !types sec_interval(13,0) and double(53,0) are not equal for column 'f1' CODE = 42000 diff --git a/sql/test/pg_regress/Tests/interval.stable.err.int128 b/sql/test/pg_regress/Tests/interval.stable.err.int128 --- a/sql/test/pg_regress/Tests/interval.stable.err.int128 +++ b/sql/test/pg_regress/Tests/interval.stable.err.int128 @@ -145,10 +145,6 @@ QUERY = SELECT '' AS nine, INTERVAL_TBL. ERROR = !Wrong format (@ 3 seconds ago) CODE = 42000 MAPI = (monetdb) /var/tmp/mtest-30274/.s.monetdb.37685 -QUERY = select avg(f1) from interval_tbl; -ERROR = !types sec_interval(13,0) and double(53,0) are not equal for column 'f1' -CODE = 42000 -MAPI = (monetdb) /var/tmp/mtest-30274/.s.monetdb.37685 QUERY = select avg(cast(f1 as double)) from interval_tbl; ERROR = !types sec_interval(13,0) and double(53,0) are not equal for column 'f1' CODE = 42000 diff --git a/sql/test/pg_regress/Tests/interval.stable.out b/sql/test/pg_regress/Tests/interval.stable.out --- a/sql/test/pg_regress/Tests/interval.stable.out +++ b/sql/test/pg_regress/Tests/interval.stable.out @@ -58,6 +58,12 @@ stdout of test 'interval` in directory ' % 0, 15 # length [ "", 63513504000.000 ] [ "", 1.234 ] +#select avg(f1) from interval_tbl; +% sys.L3 # table_name +% L3 # name +% double # type +% 24 # length +[ 3.1756752e+13] #select avg(cast(f1 as decimal)) from interval_tbl; % sys.L5 # table_name % L4 # name diff --git a/sql/test/pg_regress/Tests/interval.stable.out.int128 b/sql/test/pg_regress/Tests/interval.stable.out.int128 --- a/sql/test/pg_regress/Tests/interval.stable.out.int128 +++ b/sql/test/pg_regress/Tests/interval.stable.out.int128 @@ -58,6 +58,12 @@ stdout of test 'interval` in directory ' % 0, 15 # length [ "", 63513504000.000 ] [ "", 1.234 ] +#select avg(f1) from interval_tbl; +% sys.L3 # table_name +% L3 # name +% double # type +% 24 # length +[ 3.1756752e+13] #select avg(cast(f1 as decimal)) from interval_tbl; % sys.L4 # table_name % L4 # name diff --git a/sql/test/pg_regress/Tests/timestamp.sql b/sql/test/pg_regress/Tests/timestamp.sql --- a/sql/test/pg_regress/Tests/timestamp.sql +++ b/sql/test/pg_regress/Tests/timestamp.sql @@ -6,11 +6,9 @@ CREATE TABLE TIMESTAMP_TBL ( d1 timestamp(2) ); DECLARE test_now timestamp(2); -DECLARE test_current_timestamp timestamp(2); DECLARE test_current_date date; SET test_now = now; -SET test_current_timestamp = current_timestamp; SET test_current_date = current_date;
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: 4f773a582e89 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4f773a582e89 Modified Files: sql/common/sql_types.c sql/server/sql_scan.c Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (23 lines): 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 @@ -1663,6 +1663,9 @@ sqltypeinit( sql_allocator *sa) #endif sql_create_aggr(sa, "avg", "aggr", "avg", FLT, DBL); + sql_create_aggr(sa, "avg", "aggr", "avg", MONINT, DBL); + sql_create_aggr(sa, "avg", "aggr", "avg", SECINT, DBL); + sql_create_aggr(sa, "count_no_nil", "aggr", "count_no_nil", NULL, LNG); sql_create_aggr(sa, "count", "aggr", "count", NULL, LNG); @@ -1850,6 +1853,9 @@ sqltypeinit( sql_allocator *sa) sql_create_analytic(sa, "avg", "sql", "avg", HGE, DBL, SCALE_NONE); #endif + sql_create_analytic(sa, "avg", "sql", "avg", MONINT, DBL, SCALE_NONE); + sql_create_analytic(sa, "avg", "sql", "avg", SECINT, DBL, SCALE_NONE); + #if 0 t = decimals; // BTE sql_create_analytic(sa, "avg", "sql", "avg", *(t), DBL, SCALE_NONE); ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019
Changeset: 718f2bb5d468 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=718f2bb5d468 Modified Files: sql/backends/monet5/rel_bin.c sql/server/sql_scan.c Branch: Nov2019 Log Message: Merge with Apr2019 diffs (54 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 @@ -566,7 +566,6 @@ exp_bin(backend *be, sql_exp *e, stmt *l case e_convert: { /* if input is type any NULL or column of nulls, change type */ list *tps = e->r; - sql_exp *ll = (sql_exp *) e->l; sql_subtype *from = tps->h->data; sql_subtype *to = tps->h->next->data; stmt *l; @@ -574,19 +573,11 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (from->type->localtype == 0) { l = stmt_atom(be, atom_general(sql->sa, to, NULL)); } else { - l = exp_bin(be, ll, left, right, grp, ext, cnt, sel); + l = exp_bin(be, e->l, left, right, grp, ext, cnt, sel); } if (!l) return NULL; - /* if attempting to convert between strings, no conversion is needed */ - if (ll->type == e_column && EC_VARCHAR(from->type->eclass) && EC_VARCHAR(to->type->eclass)) { - sql_subtype *tpe = tail_type(l); - assert(tpe->type->localtype == TYPE_str); - tpe->digits = MAX(from->digits, to->digits); /* set the number of digits as the max between the two */ - s = l; - } else { - s = stmt_convert(be, l, from, to, sel); - } + s = stmt_convert(be, l, from, to, sel); } break; case e_func: { node *en; 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 @@ -639,7 +639,7 @@ scanner_getc(struct scanner *lc) int c, m, n, mask; if (scanner_read_more(lc, 1) == EOF) { - lc->errstr = "end of input stream"; + lc->errstr = SQLSTATE(42000) "end of input stream"; return EOF; } lc->errstr = NULL; @@ -679,7 +679,7 @@ scanner_getc(struct scanner *lc) } if ((c & mask) == 0) { /* incorrect UTF-8 sequence: not shortest possible */ - lc->errstr = "!not shortest possible UTF-8 sequence"; + lc->errstr = SQLSTATE(42000) "not shortest possible UTF-8 sequence"; goto error; } ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: 64fc6c9b838a for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=64fc6c9b838a Modified Files: monetdb5/modules/mal/mal_mapi.c sql/ChangeLog.Apr2019 sql/backends/monet5/rel_bin.c sql/server/sql_scan.c sql/server/sql_scan.h Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (162 lines): diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c --- a/monetdb5/modules/mal/mal_mapi.c +++ b/monetdb5/modules/mal/mal_mapi.c @@ -126,6 +126,7 @@ static void generateChallenge(str buf, i struct challengedata { stream *in; stream *out; + char challenge[13]; }; static void @@ -145,6 +146,7 @@ doChallenge(void *data) #ifdef _MSC_VER srand((unsigned int) GDKusec()); #endif + memcpy(challenge, ((struct challengedata *) data)->challenge, sizeof(challenge)); GDKfree(data); if (buf == NULL) { close_stream(fdin); @@ -152,9 +154,6 @@ doChallenge(void *data) return; } - /* generate the challenge string */ - generateChallenge(challenge, 8, 12); - // send the challenge over the block stream mnstr_printf(fdout, "%s:mserver:9:%s:%s:%s:", challenge, @@ -503,6 +502,10 @@ SERVERlistenThread(SOCKET *Sock) char name[16]; snprintf(name, sizeof(name), "client%d", (int) ATOMIC_INC()); + + /* generate the challenge string */ + generateChallenge(data->challenge, 8, 12); + if ((tid = THRcreate(doChallenge, data, MT_THR_DETACHED, name)) == 0) { mnstr_destroy(data->in); mnstr_destroy(data->out); @@ -1087,6 +1090,10 @@ SERVERclient(void *res, const Stream *In char name[16]; snprintf(name, sizeof(name), "client%d", (int) ATOMIC_INC()); + + /* generate the challenge string */ + generateChallenge(data->challenge, 8, 12); + if ((tid = THRcreate(doChallenge, data, MT_THR_DETACHED, name)) == 0) { mnstr_destroy(data->in); mnstr_destroy(data->out); diff --git a/sql/ChangeLog.Apr2019 b/sql/ChangeLog.Apr2019 --- a/sql/ChangeLog.Apr2019 +++ b/sql/ChangeLog.Apr2019 @@ -1,3 +1,7 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Wed Sep 25 2019 Sjoerd Mullender +- Strings are now limited to 1GB, double-quoted tokens are limited to 2kB. + These sizes are bytes of (UTF-8 encoded) input data. + 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 @@ -566,6 +566,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l case e_convert: { /* if input is type any NULL or column of nulls, change type */ list *tps = e->r; + sql_exp *ll = (sql_exp *) e->l; sql_subtype *from = tps->h->data; sql_subtype *to = tps->h->next->data; stmt *l; @@ -573,11 +574,19 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (from->type->localtype == 0) { l = stmt_atom(be, atom_general(sql->sa, to, NULL)); } else { - l = exp_bin(be, e->l, left, right, grp, ext, cnt, sel); + l = exp_bin(be, ll, left, right, grp, ext, cnt, sel); } if (!l) return NULL; - s = stmt_convert(be, l, from, to, sel); + /* if attempting to convert between strings, no conversion is needed */ + if (ll->type == e_column && EC_VARCHAR(from->type->eclass) && EC_VARCHAR(to->type->eclass)) { + sql_subtype *tpe = tail_type(l); + assert(tpe->type->localtype == TYPE_str); + tpe->digits = MAX(from->digits, to->digits); /* set the number of digits as the max between the two */ + s = l; + } else { + s = stmt_convert(be, l, from, to, sel); + } } break; case e_func: { node *en; 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 @@ -707,29 +707,37 @@ scanner_string(mvc *c, int quote, bool e bstream *rs = lc->rs; int cur = quote; bool escape = false; + const size_t limit = quote == '"' ? 1 << 11 : 1 << 30; lc->started = 1; while (cur != EOF) { - size_t pos = rs->pos + lc->yycur; + size_t pos = 0; + const size_t yycur = rs->pos + lc->yycur; - while (cur != EOF && (((cur = rs->buf[pos++]) & 0x80) == 0) && cur && (cur != quote || escape)) { + while (cur != EOF && pos < limit && +
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: 83ad3c922c85 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=83ad3c922c85 Modified Files: sql/test/rename/Tests/All Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (9 lines): diff --git a/sql/test/rename/Tests/All b/sql/test/rename/Tests/All --- a/sql/test/rename/Tests/All +++ b/sql/test/rename/Tests/All @@ -9,4 +9,4 @@ rename07 rename08 rename09 rename10 -rename11 +HAVE_PYMONETDB?rename11 ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: 8a5c94f08733 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8a5c94f08733 Modified Files: gdk/gdk_group.c sql/backends/monet5/rel_bin.c sql/server/rel_updates.c Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (37 lines): diff --git a/gdk/gdk_group.c b/gdk/gdk_group.c --- a/gdk/gdk_group.c +++ b/gdk/gdk_group.c @@ -713,8 +713,7 @@ BATgroup_internal(BAT **groups, BAT **ex maxgrps += BATcount(h); if (maxgrps < GROUPBATINCR) maxgrps = GROUPBATINCR; - if (b->twidth <= 2 && - maxgrps > ((BUN) 1 << (8 << (b->twidth == 2 + if (b->twidth <= 2) maxgrps = (BUN) 1 << (8 << (b->twidth == 2)); if (extents) { en = COLnew(0, TYPE_oid, maxgrps, TRANSIENT); 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 @@ -1293,6 +1293,8 @@ rel_parse_value(backend *be, char *query bstream_destroy(m->scanner.rs); m->sym = NULL; + o.vars = m->vars; /* may have been realloc'ed */ + o.sizevars = m->sizevars; if (m->session->status || m->errstr[0]) { int status = m->session->status; char errstr[ERRSIZE]; diff --git a/sql/server/rel_updates.c b/sql/server/rel_updates.c --- a/sql/server/rel_updates.c +++ b/sql/server/rel_updates.c @@ -2204,6 +2204,8 @@ rel_parse_val(mvc *m, char *query, char bstream_destroy(m->scanner.rs); m->sym = NULL; + o.vars = m->vars; /* may have been realloc'ed */ + o.sizevars = m->sizevars; if (m->session->status || m->errstr[0]) { int status = m->session->status; char errstr[ERRSIZE]; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: 9c2187be6f8b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9c2187be6f8b Added Files: sql/test/BugTracker-2019/Tests/select-char.Bug-6761.stable.err sql/test/BugTracker-2019/Tests/select-char.Bug-6761.stable.out Modified Files: sql/backends/monet5/rel_bin.c sql/rel.txt sql/server/rel_optimizer.c sql/test/BugTracker-2019/Tests/All sql/test/BugTracker-2019/Tests/select-char.Bug-6761.sql Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (283 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 @@ -565,6 +565,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l } break; case e_convert: { /* if input is type any NULL or column of nulls, change type */ + sql_exp *ll = (sql_exp *) e->l; list *tps = e->r; sql_subtype *from = tps->h->data; sql_subtype *to = tps->h->next->data; @@ -573,11 +574,16 @@ exp_bin(backend *be, sql_exp *e, stmt *l if (from->type->localtype == 0) { l = stmt_atom(be, atom_general(sql->sa, to, NULL)); } else { - l = exp_bin(be, e->l, left, right, grp, ext, cnt, sel); + l = exp_bin(be, ll, left, right, grp, ext, cnt, sel); } - if (!l) + if (!l) return NULL; - s = stmt_convert(be, l, from, to, sel); + /* if attempting to convert between strings, no conversion is needed */ + if (ll->type == e_column && EC_VARCHAR(from->type->eclass) && EC_VARCHAR(to->type->eclass)) { + s = l; + } else { + s = stmt_convert(be, l, from, to, sel); + } } break; case e_func: { node *en; diff --git a/sql/rel.txt b/sql/rel.txt --- a/sql/rel.txt +++ b/sql/rel.txt @@ -30,27 +30,27 @@ DDL (card 0!, top of the tree always) -> rused in ddl_list and ddl_exception SELECT (card MULTI or same ...?) - -> exps selection expressions (ie all e_cmp) + -> exps selection expressions (ie all e_cmp or e_atom of type bit) -> lis relation LEFT|RIGHT|FULL JOIN (card MULTI) - -> exps join expressions (ie all e_cmp) + -> exps join expressions (ie all e_cmp or e_atom of type bit) -> lis left relation - -> ris rigth relation + -> ris right relation -> flag LEFT (keep left order, only used during code generation) SEMI/ANTI (card MULTI) - -> exps join expressions (ie all e_cmp) + -> exps join expressions (ie all e_cmp or e_atom of type bit) -> lis left relation - -> ris rigth relation + -> ris right relation UNION|EXCEPT|INTERSECT (card ATOM, AGGR or MULTI (same card as lower relation)) -> exps is list of projection expressions -> lis left relation - -> ris rigth relation + -> ris right relation PROJECT (card ATOM, AGGR or MULTI (same card as lower relation)) -> exps is list of projection expressions diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c --- a/sql/server/rel_optimizer.c +++ b/sql/server/rel_optimizer.c @@ -7955,7 +7955,7 @@ rel_reduce_casts(int *changes, mvc *sql, } } if (anti) set_anti(e); - n->data = e; + n->data = e; } } return rel; diff --git a/sql/test/BugTracker-2019/Tests/All b/sql/test/BugTracker-2019/Tests/All --- a/sql/test/BugTracker-2019/Tests/All +++ b/sql/test/BugTracker-2019/Tests/All @@ -34,5 +34,5 @@ HAVE_PYMONETDB?remote-table-non-existent cte-union.Bug-6755 merge-table-limit.Bug-6756 double-free.Bug-6757 -HAVE_LIBPY?python-loader-string.Bug-6759 +HAVE_LIBPY3?python-loader-string.Bug-6759 select-char.Bug-6761 diff --git a/sql/test/BugTracker-2019/Tests/select-char.Bug-6761.sql b/sql/test/BugTracker-2019/Tests/select-char.Bug-6761.sql --- a/sql/test/BugTracker-2019/Tests/select-char.Bug-6761.sql +++ b/sql/test/BugTracker-2019/Tests/select-char.Bug-6761.sql @@ -403,5 +403,7 @@ 2019-09-17 "EMLDU" "EMLDU" "Inter-Region 2019-09-17 "EMLDU" "EMLDU" "Inter-Region" "Hybrid""Investment" "Bullish" "Directional" "EMLDU" "Un-Assigned(0)""Emerging Europe" "Czech Republic""CZK" "IR/Currency Swap" "IRS_SLYLSSJS9" "ZZZ" 2024-08-08 "Steinberg Bernard" "Trading" "CZK PFL RFI
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: b03059048a25 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b03059048a25 Modified Files: common/stream/stream.c configure.ag monetdb5/modules/mal/mal_mapi.c sql/test/BugTracker-2019/Tests/All sql/test/BugTracker-2019/Tests/double-free.Bug-6757.sql tools/merovingian/daemon/client.c tools/merovingian/daemon/controlrunner.c tools/merovingian/daemon/discoveryrunner.c tools/merovingian/daemon/merovingian.c tools/merovingian/daemon/multiplex-funnel.c Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (truncated from 719 to 300 lines): diff --git a/common/stream/stream.c b/common/stream/stream.c --- a/common/stream/stream.c +++ b/common/stream/stream.c @@ -73,6 +73,9 @@ # include # include #endif +#ifdef HAVE_POLL_H +#include +#endif #ifdef NATIVE_WIN32 #include @@ -2489,9 +2492,21 @@ socket_read(stream *restrict s, void *re #endif for (;;) { if (s->timeout) { + int ret; +#ifdef HAVE_POLL + struct pollfd pfd; + + pfd = (struct pollfd) {.fd = s->stream_data.s, + .events = POLLIN}; + + ret = poll(, 1, (int) s->timeout); + if (ret == -1 || (pfd.revents & POLLERR)) { + s->errnr = MNSTR_READ_ERROR; + return -1; + } +#else struct timeval tv; fd_set fds; - int ret; errno = 0; #ifdef _MSC_VER @@ -2512,6 +2527,7 @@ socket_read(stream *restrict s, void *re s->errnr = MNSTR_READ_ERROR; return -1; } +#endif if (ret == 0) { if (s->timeout_func == NULL || s->timeout_func()) { s->errnr = MNSTR_TIMEOUT; @@ -2520,7 +2536,11 @@ socket_read(stream *restrict s, void *re continue; } assert(ret == 1); +#ifdef HAVE_POLL + assert(pfd.revents & (POLLIN|POLLHUP)); +#else assert(FD_ISSET(s->stream_data.s, )); +#endif } #ifdef _MSC_VER nr = recv(s->stream_data.s, buf, (int) size, 0); @@ -2617,9 +2637,20 @@ static int socket_isalive(stream *s) { SOCKET fd = s->stream_data.s; - char buffer[32]; +#ifdef HAVE_POLL + struct pollfd pfd; + int ret; + pfd = (struct pollfd){.fd = fd}; + if ((ret = poll(, 1, 0)) == 0) + return 1; + if (ret < 0 || pfd.revents & (POLLERR | POLLHUP)) + return 0; + assert(0); /* unexpected revents value */ + return 0; +#else fd_set fds; struct timeval t; + char buffer[32]; t.tv_sec = 0; t.tv_usec = 0; @@ -2633,6 +2664,7 @@ socket_isalive(stream *s) #endif , NULL, NULL, ) <= 0 || recv(fd, buffer, sizeof(buffer), MSG_PEEK | MSG_DONTWAIT) != 0; +#endif } static stream * diff --git a/configure.ag b/configure.ag --- a/configure.ag +++ b/configure.ag @@ -2258,6 +2258,7 @@ AC_CHECK_HEADERS([ \ mach-o/dyld.h \ netdb.h \ netinet/in.h \ + poll.h \ procfs.h \ pwd.h \ strings.h \ @@ -2489,6 +2490,7 @@ AC_CHECK_FUNCS([\ nl_langinfo \ _NSGetExecutablePath \ pipe2 \ + poll \ popen \ posix_fadvise \ posix_fallocate \ diff --git a/monetdb5/modules/mal/mal_mapi.c b/monetdb5/modules/mal/mal_mapi.c --- a/monetdb5/modules/mal/mal_mapi.c +++ b/monetdb5/modules/mal/mal_mapi.c @@ -58,6 +58,9 @@ # include # include #endif +#ifdef HAVE_POLL_H +#include +#endif #ifdef HAVE_SYS_UIO_H # include #endif @@ -275,8 +278,13 @@ SERVERlistenThread(SOCKET *Sock) { char *msg = 0; int retval; +#ifdef HAVE_POLL + struct pollfd pfd[2]; + nfds_t npfd; +#else struct timeval tv; fd_set fds; +#endif SOCKET sock = INVALID_SOCKET; SOCKET usock = INVALID_SOCKET; SOCKET msgsock = INVALID_SOCKET; @@ -291,6 +299,17 @@ SERVERlistenThread(SOCKET *Sock) (void) ATOMIC_INC(); do { +#ifdef HAVE_POLL + npfd = 0; + if (sock != INVALID_SOCKET) + pfd[npfd++] = (struct pollfd) {.fd = sock, .events = POLLIN}; +#ifdef HAVE_SYS_UN_H + if (usock != INVALID_SOCKET) + pfd[npfd++] = (struct pollfd) {.fd = usock, .events = POLLIN}; +#endif + /* Wait up to 0.025 seconds (0.001 if testing) */ + retval = poll(pfd, npfd, GDKdebug & FORCEMITOMASK ? 10 : 25); +#else
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: dfe3ddc36d56 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=dfe3ddc36d56 Modified Files: clients/mapiclient/stethoscope.c monetdb5/mal/mal_dataflow.c sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql sql/test/BugTracker-2019/Tests/All Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (69 lines): diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c --- a/clients/mapiclient/stethoscope.c +++ b/clients/mapiclient/stethoscope.c @@ -110,7 +110,7 @@ renderEvent(EventRecord *ev){ return; fprintf(s, "[ "); fprintf(s, "%"PRId64", ", ev->eventnr); - printf("\"%s\", ", ev->time); + fprintf(s, "\"%s\", ", ev->time); if( ev->function && *ev->function) fprintf(s, "\"%s[%d]%d\", ", ev->function, ev->pc, ev->tag); else diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c --- a/monetdb5/mal/mal_dataflow.c +++ b/monetdb5/mal/mal_dataflow.c @@ -234,26 +234,30 @@ q_dequeue(Queue *q, Client cntxt) for (i = q->last - 1; i >= 0; i--) { if (q->data[i]->flow->cntxt == cntxt) { - if(minpc < 0){ + if (q->last > 1024) { + /* for long "queues", just grab the first eligible +* entry we encounter */ + minpc = i; + break; + } + /* for shorter "queues", find the oldest eligible entry */ + if (minpc < 0) { minpc = i; s = q->data[i]; } r = q->data[i]; - if( s && r && s->pc > r->pc){ + if (s && r && s->pc > r->pc) { minpc = i; s = r; } } } - if( minpc >= 0){ + if (minpc >= 0) { r = q->data[minpc]; i = minpc; q->last--; - while (i < q->last) { - q->data[i] = q->data[i + 1]; - i++; - } - } else r = NULL; + memmove(q->data + i, q->data + i + 1, (q->last - i) * sizeof(q->data[0])); + } MT_lock_unset(>l); return r; diff --git a/sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql b/sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql --- a/sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql +++ b/sql/test/BugTracker-2009/Tests/insert_into_done_by_procedure.SF-2607293.sql @@ -1,3 +1,5 @@ +start transaction; + create table get_results (schem string, clust string, real_time bigint); create procedure save_times (schem string, clust string) BEGIN @@ -14,3 +16,5 @@ select * from get_results; drop ALL procedure save_times; drop table get_results; + +rollback; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: ad4ad2617b18 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ad4ad2617b18 Modified Files: sql/server/rel_optimizer.c sql/test/BugTracker-2019/Tests/All sql/test/BugTracker-2019/Tests/cte-union.Bug-6755.stable.err sql/test/BugTracker-2019/Tests/cte-union.Bug-6755.stable.out sql/test/BugTracker-2019/Tests/sequence-first-next-value.Bug-6743.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 branch ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: 0944f0afd37d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0944f0afd37d Added Files: sql/test/BugTracker-2019/Tests/double-free.Bug-6757.sql sql/test/BugTracker-2019/Tests/double-free.Bug-6757.stable.err sql/test/BugTracker-2019/Tests/double-free.Bug-6757.stable.out Modified Files: sql/test/BugTracker-2019/Tests/All sql/test/testdb-reload/Tests/reload.py testing/process.py Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (truncated from 2012 to 300 lines): diff --git a/sql/test/BugTracker-2019/Tests/All b/sql/test/BugTracker-2019/Tests/All --- a/sql/test/BugTracker-2019/Tests/All +++ b/sql/test/BugTracker-2019/Tests/All @@ -33,4 +33,5 @@ alter_table_drop_column.Bug-6749 HAVE_PYMONETDB?remote-table-non-existent-column.Bug-6750 cte-union.Bug-6755 merge-table-limit.Bug-6756 +double-free.Bug-6757 HAVE_LIBPY3?python-loader-string.Bug-6759 diff --git a/sql/test/BugTracker-2019/Tests/double-free.Bug-6757.sql b/sql/test/BugTracker-2019/Tests/double-free.Bug-6757.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2019/Tests/double-free.Bug-6757.sql @@ -0,0 +1,976 @@ +start transaction; + +CREATE TABLE "sys"."params_str" ( + "paramname" CHARACTER LARGE OBJECT, + "value" CHARACTER LARGE OBJECT, + "prob" DOUBLE +); +CREATE TABLE "sys"."bm_0_obj_dict" ( + "id"INTEGER NOT NULL, + "idstr" CHARACTER LARGE OBJECT NOT NULL, + "prob" FLOAT(51) NOT NULL, + CONSTRAINT "bm_0_obj_dict_id_pkey" PRIMARY KEY ("id"), + CONSTRAINT "bm_0_obj_dict_idstr_unique" UNIQUE ("idstr") +); +CREATE TABLE "sys"."bm_0_obj_type" ( + "id" INTEGER NOT NULL, + "type"INTEGER NOT NULL, + "typestr" CHARACTER LARGE OBJECT NOT NULL, + "prob"DOUBLENOT NULL, + CONSTRAINT "bm_0_obj_type_id_fkey" FOREIGN KEY ("id") REFERENCES "sys"."bm_0_obj_dict" ("id"), + CONSTRAINT "bm_0_obj_type_type_fkey" FOREIGN KEY ("type") REFERENCES "sys"."bm_0_obj_dict" ("id") +); +CREATE TABLE "sys"."tr_0_obj_dict" ( + "id"INTEGER NOT NULL, + "idstr" CHARACTER LARGE OBJECT NOT NULL, + "prob" FLOAT(51) NOT NULL, + CONSTRAINT "tr_0_obj_dict_id_pkey" PRIMARY KEY ("id"), + CONSTRAINT "tr_0_obj_dict_idstr_unique" UNIQUE ("idstr") +); +CREATE TABLE "sys"."tr_0_obj_type" ( + "id" INTEGER NOT NULL, + "type"INTEGER NOT NULL, + "typestr" CHARACTER LARGE OBJECT NOT NULL, + "prob"DOUBLENOT NULL, + CONSTRAINT "tr_0_obj_type_id_fkey" FOREIGN KEY ("id") REFERENCES "sys"."tr_0_obj_dict" ("id"), + CONSTRAINT "tr_0_obj_type_type_fkey" FOREIGN KEY ("type") REFERENCES "sys"."tr_0_obj_dict" ("id") +); + +CREATE TABLE "sys"."_cachedrel_4" ( + "a1" INTEGER, + "prob" FLOAT(51) +); +CREATE TABLE "sys"."_cachedrel_5" ( + "a1" INTEGER, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_6" ( + "a1" INTEGER, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_7" ( + "a1" INTEGER, + "prob" FLOAT(51) +); +CREATE TABLE "sys"."_cachedrel_8" ( + "a1" INTEGER, + "a2" INTEGER, + "a3" CHARACTER LARGE OBJECT, + "a4" CHARACTER LARGE OBJECT, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_9" ( + "a1" INTEGER, + "a2" INTEGER, + "a3" CHARACTER LARGE OBJECT, + "a4" CHARACTER LARGE OBJECT, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_10" ( + "a1" INTEGER, + "a2" CHARACTER LARGE OBJECT, + "a3" CHARACTER LARGE OBJECT, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_11" ( + "a1" INTEGER, + "a2" CHARACTER LARGE OBJECT, + "a3" CHARACTER LARGE OBJECT, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_12" ( + "a1" CHARACTER LARGE OBJECT, + "a2" CHARACTER LARGE OBJECT, + "a3" CHARACTER LARGE OBJECT, + "a4" CHARACTER LARGE OBJECT, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_13" ( + "a1" INTEGER, + "prob" FLOAT(51) +); +CREATE TABLE "sys"."_cachedrel_14" ( + "a1" INTEGER, + "a2" INTEGER, + "a3" CHARACTER LARGE OBJECT, + "a4" CHARACTER LARGE OBJECT, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_15" ( + "a1" INTEGER, + "a2" INTEGER, + "a3" CHARACTER LARGE OBJECT, + "a4" CHARACTER LARGE OBJECT, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_16" ( + "a1" INTEGER, + "prob" FLOAT(51) +); +CREATE TABLE "sys"."_cachedrel_17" ( + "a1" INTEGER, + "a2" INTEGER, + "a3" CHARACTER LARGE OBJECT, + "a4" CHARACTER LARGE OBJECT, + "prob" DOUBLE +); +CREATE TABLE "sys"."_cachedrel_18" ( + "a1" INTEGER, + "a2" INTEGER, + "a3" CHARACTER LARGE OBJECT, +
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: 059c7884a05b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=059c7884a05b Modified Files: sql/server/rel_semantic.c tools/merovingian/daemon/controlrunner.c Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (12 lines): diff --git a/sql/server/rel_semantic.c b/sql/server/rel_semantic.c --- a/sql/server/rel_semantic.c +++ b/sql/server/rel_semantic.c @@ -88,6 +88,8 @@ rel_parse(mvc *m, sql_schema *s, char *q bstream_destroy(m->scanner.rs); m->sym = NULL; + o.vars = m->vars; /* may have been realloc'ed */ + o.sizevars = m->sizevars; if (m->session->status || m->errstr[0]) { int status = m->session->status; char errstr[ERRSIZE]; ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list
MonetDB: Nov2019 - Merge with Apr2019 branch
Changeset: b64b64deb697 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b64b64deb697 Added Files: sql/test/BugTracker-2019/Tests/python-loader-string.Bug-6759.py sql/test/BugTracker-2019/Tests/python-loader-string.Bug-6759.stable.err sql/test/BugTracker-2019/Tests/python-loader-string.Bug-6759.stable.out Modified Files: monetdb5/modules/mal/tablet.c sql/backends/monet5/sql.c sql/test/BugTracker-2019/Tests/All sql/test/BugTracker-2019/Tests/duplicates-not-eliminated-long-CASE-stmt.Bug-6697.sql Branch: Nov2019 Log Message: Merge with Apr2019 branch diffs (truncated from 338 to 300 lines): diff --git a/monetdb5/modules/mal/tablet.c b/monetdb5/modules/mal/tablet.c --- a/monetdb5/modules/mal/tablet.c +++ b/monetdb5/modules/mal/tablet.c @@ -670,10 +670,8 @@ tablet_error(READERtask *task, lng row, BUNappend(task->cntxt->error_msg, msg, false) != GDK_SUCCEED || BUNappend(task->cntxt->error_input, fcn, false) != GDK_SUCCEED) task->besteffort = 0; - if (!is_lng_nil(row) && task->rowerror) { - assert(row < task->limit); + if (!is_lng_nil(row) && task->rowerror && row < task->limit) task->rowerror[row]++; - } } if (task->as->error == NULL) { if (msg == NULL) 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 @@ -463,8 +463,7 @@ create_table_from_emit(Client cntxt, cha return msg; /* for some reason we don't have an allocator here, so make one */ - sql->sa = sa_create(); - if (!sql->sa) { + if (!(sql->sa = sa_create())) { msg = sql_error(sql, 02, SQLSTATE(HY001) "CREATE TABLE: %s", MAL_MALLOC_FAIL); goto cleanup; } @@ -480,44 +479,44 @@ create_table_from_emit(Client cntxt, cha goto cleanup; } - for(i = 0; i < ncols; i++) { + for (i = 0; i < ncols; i++) { BAT *b = columns[i].b; - sql_subtype *tpe = sql_bind_localtype(ATOMname(b->ttype)); + str atoname = ATOMname(b->ttype); + sql_subtype tpe; sql_column *col = NULL; - if (!tpe) { - msg = sql_error(sql, 02, SQLSTATE(3F000) "CREATE TABLE: could not find type for column"); - goto cleanup; + if (!strcmp(atoname, "str")) + sql_find_subtype(, "clob", 0, 0); + else { + sql_subtype *t = sql_bind_localtype(atoname); + if (!t) { + msg = sql_error(sql, 02, SQLSTATE(3F000) "CREATE TABLE: could not find type for column"); + goto cleanup; + } + tpe = *t; } - col = mvc_create_column(sql, t, columns[i].name, tpe); - if (!col) { + if (!(col = mvc_create_column(sql, t, columns[i].name, ))) { msg = sql_error(sql, 02, SQLSTATE(3F000) "CREATE TABLE: could not create column %s", columns[i].name); goto cleanup; } } - msg = create_table_or_view(sql, sname, t->base.name, t, 0); - if (msg != MAL_SUCCEED) { + if ((msg = create_table_or_view(sql, sname, t->base.name, t, 0)) != MAL_SUCCEED) goto cleanup; - } - t = mvc_bind_table(sql, s, tname); - if (!t) { + if (!(t = mvc_bind_table(sql, s, tname))) { msg = sql_error(sql, 02, SQLSTATE(3F000) "CREATE TABLE: could not bind table %s", tname); goto cleanup; } - for(i = 0; i < ncols; i++) { + for (i = 0; i < ncols; i++) { BAT *b = columns[i].b; sql_column *col = NULL; - col = mvc_bind_column(sql,t, columns[i].name); - if (!col) { + if (!(col = mvc_bind_column(sql, t, columns[i].name))) { msg = sql_error(sql, 02, SQLSTATE(3F000) "CREATE TABLE: could not bind column %s", columns[i].name); goto cleanup; } - msg = mvc_append_column(sql->session->tr, col, b); - if (msg != MAL_SUCCEED) { + if ((msg = mvc_append_column(sql->session->tr, col, b)) != MAL_SUCCEED) goto cleanup; - } } cleanup: @@ -543,8 +542,7 @@ append_to_table_from_emit(Client cntxt, return msg; /* for some reason we don't have an allocator here, so make one */ - sql->sa = sa_create(); - if (!sql->sa) { + if (!(sql->sa = sa_create())) { msg = sql_error(sql, 02,
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: ae96662f93e6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ae96662f93e6 Added Files: sql/test/BugTracker-2019/Tests/merge-table-limit.Bug-6756.sql sql/test/BugTracker-2019/Tests/merge-table-limit.Bug-6756.stable.err sql/test/BugTracker-2019/Tests/merge-table-limit.Bug-6756.stable.out Modified Files: gdk/gdk_string.c monetdb5/mal/mal_client.c monetdb5/modules/mal/tablet.c sql/server/rel_optimizer.c sql/test/BugTracker-2019/Tests/All Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (truncated from 537 to 300 lines): diff --git a/gdk/gdk_string.c b/gdk/gdk_string.c --- a/gdk/gdk_string.c +++ b/gdk/gdk_string.c @@ -258,6 +258,41 @@ strPut(Heap *h, var_t *dst, const char * } /* the string was not found in the heap, we need to enter it */ + if (v[0] != '\200' || v[1] != '\0') { + /* check that string is correctly encoded UTF-8; there +* was no need to do this earlier: if the string was +* found above, it must have gone through here in the +* past */ + int nutf8 = 0; + int m = 0; + for (size_t i = 0; v[i]; i++) { + if (nutf8 > 0) { + if ((v[i] & 0xC0) != 0x80 || + (m != 0 && (v[i] & m) == 0)) { + badutf8: + GDKerror("strPut: incorrectly encoded UTF-8"); + return 0; + } + m = 0; + nutf8--; + } else if ((v[i] & 0xE0) == 0xC0) { + nutf8 = 1; + if ((v[i] & 0x1E) == 0) + goto badutf8; + } else if ((v[i] & 0xF0) == 0xE0) { + nutf8 = 2; + if ((v[i] & 0x0F) == 0) + m = 0x20; + } else if ((v[i] & 0xF8) == 0xF0) { + nutf8 = 3; + if ((v[i] & 0x07) == 0) + m = 0x30; + } else if ((v[i] & 0x80) != 0) { + goto badutf8; + } + } + } + pad = GDK_VARALIGN - (h->free & (GDK_VARALIGN - 1)); if (elimbase == 0) {/* i.e. h->free < GDK_ELIMLIMIT */ if (pad < sizeof(stridx_t)) { @@ -310,56 +345,6 @@ strPut(Heap *h, var_t *dst, const char * /* insert string */ pos = h->free + pad + extralen; *dst = (var_t) pos; -#ifndef NDEBUG - /* just before inserting into the heap, make sure that the -* string is actually UTF-8 (if we encountered a return -* statement before this, the string was already in the heap, -* and hence already checked) */ - if (v[0] != '\200' || v[1] != '\0') { - /* not str_nil, must be UTF-8 */ - size_t i; - - for (i = 0; v[i] != '\0'; i++) { - /* check that v[i] is the start of a validly -* coded UTF-8 sequence: this involves -* checking that the first byte is a valid -* start byte and is followed by the correct -* number of follow-up bytes, but also that -* the sequence cannot be shorter */ - if ((v[i] & 0x80) == 0) { - /* 0aaa */ - continue; - } else if ((v[i] & 0xE0) == 0xC0) { - /* 110a 10aa -* one of the b's must be set*/ - assert(v[i] & 0x4D); - i++; - assert((v[i] & 0xC0) == 0x80); - } else if ((v[i] & 0xF0) == 0xE0) { - /* 1110 10ca 10aa -* one of the c's must be set*/ - assert(v[i] & 0x0F || v[i + 1] & 0x20); - i++; - assert((v[i] & 0xC0) == 0x80); - i++; - assert((v[i] & 0xC0) == 0x80); - } else if ((v[i] & 0xF8) == 0xF0) { - /* 0ddd 10dd 10ca 10aa -* one of the d's must be set */ - assert(v[i] & 0x07 || v[i + 1] & 0x30); - i++; - assert((v[i] & 0xC0) == 0x80); -
MonetDB: Nov2019 - Merge with Apr2019 and test approval
Changeset: 44fe79e1edf2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=44fe79e1edf2 Added Files: sql/test/BugTracker-2019/Tests/cte-union.Bug-6755.sql Modified Files: sql/server/rel_select.c sql/test/BugTracker-2019/Tests/All sql/test/subquery/Tests/subquery.stable.err sql/test/subquery/Tests/subquery.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 and test approval diffs (truncated from 311 to 300 lines): diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -3912,6 +3912,13 @@ static sql_exp * if (uaname) GDKfree(uaname); return e; + } else if (!query_has_outer(query) && is_sql_where(f)) { + char *uaname = GDKmalloc(strlen(aname) + 1); + sql_exp *e = sql_error(sql, 02, SQLSTATE(42000) "%s: not allowed in WHERE clause", + uaname ? toUpperCopy(uaname, aname) : aname); + if (uaname) + GDKfree(uaname); + return e; } if (groupby->op != op_groupby) {/* implicit groupby */ @@ -3931,15 +3938,6 @@ static sql_exp * if (!*rel) return NULL; - if (!query_has_outer(query) && is_sql_where(f)) { - char *uaname = GDKmalloc(strlen(aname) + 1); - sql_exp *e = sql_error(sql, 02, SQLSTATE(42000) "%s: not allowed in WHERE clause", - uaname ? toUpperCopy(uaname, aname) : aname); - if (uaname) - GDKfree(uaname); - return e; - } - if (!args->data.sym) { /* count(*) case */ sql_exp *e; diff --git a/sql/test/BugTracker-2019/Tests/All b/sql/test/BugTracker-2019/Tests/All --- a/sql/test/BugTracker-2019/Tests/All +++ b/sql/test/BugTracker-2019/Tests/All @@ -31,3 +31,4 @@ sequences-defaults.Bug-6744 sequences-types.Bug-6745 alter_table_drop_column.Bug-6749 HAVE_PYMONETDB?remote-table-non-existent-column.Bug-6750 +cte-union.Bug-6755 diff --git a/sql/test/BugTracker-2019/Tests/cte-union.Bug-6755.sql b/sql/test/BugTracker-2019/Tests/cte-union.Bug-6755.sql new file mode 100644 --- /dev/null +++ b/sql/test/BugTracker-2019/Tests/cte-union.Bug-6755.sql @@ -0,0 +1,39 @@ +start transaction; +CREATE TABLE ontime ( +"Year" SMALLINT, +"Month" TINYINT, +"DayofMonth" TINYINT, +"Carrier"CHAR(2), +"CRSDepTime" DECIMAL(8,2), +"ArrDelay" DECIMAL(8,2) +); +CREATE TABLE tmp ( +"Hour" TINYINT, +"PredictedArrDelay" DECIMAL(8,2) DEFAULT 0.0 +); +INSERT INTO tmp ("Hour") +VALUES +(0), (1), (2), (3), (4), (5), +(6), (7), (8), (9), (10), (11), +(12), (13), (14), (15), (16), (17), +(18), (19), (20), (21), (22), (23); + +INSERT INTO ontime VALUES (2001, 9, 2, 'AA', 900.00, -6.00); +ALTER TABLE "ontime" SET READ ONLY; +ANALYZE sys.ontime; +WITH t1 AS ( +SELECT "Carrier", CAST (FLOOR("CRSDepTime"%2400/100) AS INT) AS "Hour", + CAST(AVG("ArrDelay") AS DECIMAL(8,2)) AS "PredictedArrDelay" +FROM ontime +WHERE "Year" = 2007 AND "Month" = 10 AND "DayofMonth" = 24 +GROUP BY "Carrier", "Hour" +), +t2 AS ( +SELECT t."Carrier", tmp.* +FROM tmp, (SELECT DISTINCT "Carrier" FROM t1) AS t +) +SELECT "Carrier", "Hour", SUM("PredictedArrDelay") +FROM (SELECT * FROM t1 UNION SELECT * FROM t2) AS t +GROUP BY "Carrier", "Hour" +ORDER BY "Carrier", "Hour"; +rollback; diff --git a/sql/test/subquery/Tests/subquery.stable.err b/sql/test/subquery/Tests/subquery.stable.err --- a/sql/test/subquery/Tests/subquery.stable.err +++ b/sql/test/subquery/Tests/subquery.stable.err @@ -46,6 +46,10 @@ MAPI = (monetdb) /var/tmp/mtest-28086/. QUERY = SELECT * FROM integers WHERE i=(SELECT i, i + 2 FROM integers); ERROR = !SELECT: subquery must return only one column CODE = 42000 +MAPI = (monetdb) /var/tmp/mtest-17217/.s.monetdb.30774 +QUERY = SELECT 1 FROM integers WHERE SUM(i) > 1; --aggregates not allowed in where clause +ERROR = !SUM: not allowed in WHERE clause +CODE = 42000 # 17:27:37 > # 17:27:37 > "Done." diff --git a/sql/test/subquery/Tests/subquery.stable.out b/sql/test/subquery/Tests/subquery.stable.out --- a/sql/test/subquery/Tests/subquery.stable.out +++ b/sql/test/subquery/Tests/subquery.stable.out @@ -90,8 +90,8 @@ stdout of test 'subquery` in directory ' % 1 # length [ 3] #SELECT *, (SELECT MAX(i) FROM integers) FROM integers ORDER BY i; -% sys.integers,.L6 # table_name -% i, L6 # name +% sys.integers,.L3 # table_name +% i, L3 # name % int, int # type % 1, 1 # length [ NULL,3 ] @@ -99,14 +99,14 @@ stdout of test 'subquery` in directory ' [ 2, 3 ] [ 3, 3 ] #SELECT (SELECT 42) AS k, MAX(i) FROM integers GROUP BY k; -- 42, 3 -% .L2,
MonetDB: Nov2019 - Merge with Apr2019
Changeset: 70e68ea457e2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=70e68ea457e2 Modified Files: clients/mapiclient/mclient.c clients/mapiclient/mhelp.c sql/jdbc/tests/Tests/Test_JdbcClient.stable.out sql/server/rel_select.c sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out sql/test/analytics/Tests/analytics09.sql sql/test/analytics/Tests/analytics09.stable.out Branch: Nov2019 Log Message: Merge with Apr2019 diffs (168 lines): diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -1933,9 +1933,7 @@ format_result(Mapi mid, MapiHdl hdl, boo SQLqueryEcho(hdl); if (formatter == TABLEformatter || formatter == ROWCOUNTformatter) - mnstr_printf(toConsole, -"auto commit mode: %s\n", -mapi_get_autocommit(mid) ? "on" : "off"); + mnstr_printf(toConsole, "operation successful\n"); timerHuman(sqloptimizer, maloptimizer, querytime, singleinstr, false); continue; case Q_PREPARE: diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c --- a/clients/mapiclient/mhelp.c +++ b/clients/mapiclient/mhelp.c @@ -444,9 +444,9 @@ SQLhelp sqlhelp1[] = { "See also https://www.monetdb.org/Documentation/SQLreference/TableExpressions"}, {"SET", "Assign a value to a variable or column", -"SET '=' simple_atom", +"SET ident '=' simple_atom", "simple_atom", -NULL}, +"See also https://www.monetdb.org/Documentation/Manuals/SQLreference/Variables"}, {"SET LOCAL TRANSACTION", "", "START LOCAL TRANSACTION transactionmode", diff --git a/sql/jdbc/tests/Tests/Test_JdbcClient.stable.out b/sql/jdbc/tests/Tests/Test_JdbcClient.stable.out --- a/sql/jdbc/tests/Tests/Test_JdbcClient.stable.out +++ b/sql/jdbc/tests/Tests/Test_JdbcClient.stable.out @@ -29,7 +29,7 @@ stdout of test 'Test_JdbcClient` in dire # 18:15:40 > java nl.cwi.monetdb.client.JdbcClient -h catskill -p 31817 -d mTests_sql_jdbc_tests --help # 18:15:40 > -Usage java -jar jdbcclient.jar +Usage java -jar jdbcclient.jre7.jar [-h host[:port]] [-p port] [-f file] [-u user] [-l language] [-d database] [-e] [-D [table]] [-X] diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -5065,18 +5065,34 @@ opt_groupby_add_exp(mvc *sql, sql_rel *p if (!exp_name(in)) exp_label(sql->sa, in, ++sql->label); found = exps_find_exp( p->exps, in); - if (!found) + if (!found) { + sql_rel *l = p->l; + while (l && !is_base(l->op)) { + if (!exps_find_exp(l->exps, in)) + append(l->exps, exp_copy(sql->sa, in)); + else + break; + l = l->l; + } append(p->exps, in); - else + } else in = found; in = exp_ref(sql->sa, in); } else if (pp && pp->op == op_groupby) { if (!exp_name(in)) exp_label(sql->sa, in, ++sql->label); found = exps_find_exp( p->exps, in); - if (!found) + if (!found) { + sql_rel *l = p->l; + while (l && !is_base(l->op)) { + if (!exps_find_exp(l->exps, in)) + append(l->exps, exp_copy(sql->sa, in)); + else + break; + l = l->l; + } append(p->exps, in); - else + } else in = found; in = exp_ref(sql->sa, in); } diff --git a/sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out b/sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out --- a/sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out +++ b/sql/test/BugTracker/Tests/authorization.SF-1430616.stable.out @@ -20,50 +20,9 @@ stdout of test 'authorization.SF-1430616 # MonetDB/Python module loaded # MonetDB/R module loaded -# SQL catalog created, loading sql scripts once -# loading sql script: 09_like.sql -# loading sql script: 10_math.sql -# loading sql script: 11_times.sql -# loading sql script: 12_url.sql -#
MonetDB: Nov2019 - Merge with Apr2019 branch.
Changeset: 21e85f0d6944 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=21e85f0d6944 Modified Files: testing/Mtest.py.in Branch: Nov2019 Log Message: Merge with Apr2019 branch. diffs (43 lines): diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in --- a/testing/Mtest.py.in +++ b/testing/Mtest.py.in @@ -3349,8 +3349,8 @@ def CheckClassPath() : cp = '' cpx = '' JARS = { -'HAVE_MONETDBJDBC_JAR' : re.compile('^monetdb-jdbc-[0-9]\.[0-9]+(-[a-f0-9]{12})?\.jar$'), -'HAVE_JDBCCLIENT_JAR' : re.compile('^jdbcclient\.jar$'), +'HAVE_MONETDBJDBC_JAR' : re.compile('^monetdb-jdbc-[0-9]\.[0-9]+(-[a-f0-9]{12})?\.jre[0-9]+\.jar$'), +'HAVE_JDBCCLIENT_JAR' : re.compile('^jdbcclient\.jre[0-9]+\.jar$'), 'HAVE_JDBCTESTS_JAR' : re.compile('^jdbctests\.jar$'), } # check for known JARs in CLASSPATH files @@ -3359,19 +3359,17 @@ def CheckClassPath() : for f in os.listdir(p): if not f.endswith('.jar'): continue -C = 'HAVE_%s' % f.upper().replace('.','_') -if C not in JARS: -C = 'HAVE_MONETDBJDBC_JAR' +for C in JARS: +if JARS[C].match(f): +CONDITIONALS[C] = '#' +cp = os.path.join(p, f) + os.pathsep + cp +break +elif os.path.isfile(p): +f = os.path.basename(p) +for C in JARS: if JARS[C].match(f): CONDITIONALS[C] = '#' -cp = os.path.join(p, f) + os.pathsep + cp -elif os.path.isfile(p): -f = os.path.basename(p) -C = 'HAVE_%s' % f.upper().replace('.','_') -if C not in JARS: -C = 'HAVE_MONETDBJDBC_JAR' -if JARS[C].match(f): -CONDITIONALS[C] = '#' +break # check for known JARs in CLASSPATH directories # + fall-back using pkgdatadir/lib cpx += _configure(os.path.join('@QXdatadir@','monetdb','lib')) ___ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list