MonetDB: nospare - merged changes

2021-02-04 Thread Niels Nes
Changeset: 9d55affc93c1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9d55affc93c1
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128

sql/test/BugDay_2005-10-06_2.9.3/Tests/CrashMe_SQL_server_crash-2.SF-921673.test

sql/test/BugDay_2005-11-09_2.8/Tests/ORDER_BY_evaluation_error.SF-1023658.test
sql/test/BugTracker-2017/Tests/parsererror.Bug-6381.test
sql/test/BugTracker-2017/Tests/side-effect.Bug-6397.test

sql/test/BugTracker-2018/Tests/groupby_having_orderby_count.Bug-6624.test
sql/test/BugTracker-2019/Tests/alter_table_set_schema.Bug-6701.test
sql/test/BugTracker/Tests/explain.SF-1739353.test
sql/test/SQLancer/Tests/sqlancer03.test
sql/test/SQLancer/Tests/sqlancer07.test
sql/test/bugs/Tests/groupby_having-bug-sf-947600.test
sql/test/bugs/Tests/innerjoin_multiple-bug-sf-943661.test
sql/test/bugs/Tests/select_orderby_alias-bug-sf-1024615.test
sql/test/merge-partitions/Tests/mergepart01.test
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.test
sql/test/sys-schema/Tests/check_Not_Nullable_columns.test
testing/Mtest.py.in
Branch: nospare
Log Message:

merged changes


diffs (truncated from 214188 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -8798,7 +8798,7 @@ stdout of test 'MAL-signatures` in direc
 [ "iterator",  "next", "command iterator.next(X_1:lng, X_2:lng):lng ", 
"ITRnext_lng;", ""  ]
 [ "iterator",  "next", "command iterator.next(X_1:oid, X_2:oid):oid ", 
"ITRnext_oid;", ""  ]
 [ "iterator",  "next", "command iterator.next(X_1:sht, X_2:sht):sht ", 
"ITRnext_sht;", ""  ]
-[ "json",  "dump", "pattern json.dump(X_1:json):void ","JSONdump;",
""  ]
+[ "json",  "dump", "pattern json.dump(X_1:json):bat[:str] ",   
"JSONdump;",""  ]
 [ "json",  "filter",   "command json.filter(X_1:json, X_2:str):json ", 
"JSONfilter;",  ""  ]
 [ "json",  "filter",   "command json.filter(X_1:json, X_2:bte, 
X_3:str):json ","JSONfilterArrayDefault_bte;",  ""  ]
 [ "json",  "filter",   "command json.filter(X_1:json, X_2:int, 
X_3:str):json ","JSONfilterArrayDefault_int;",  ""  ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -12094,7 +12094,7 @@ stdout of test 'MAL-signatures` in direc
 [ "iterator",  "next", "command iterator.next(X_1:lng, X_2:lng):lng ", 
"ITRnext_lng;", ""  ]
 [ "iterator",  "next", "command iterator.next(X_1:oid, X_2:oid):oid ", 
"ITRnext_oid;", ""  ]
 [ "iterator",  "next", "command iterator.next(X_1:sht, X_2:sht):sht ", 
"ITRnext_sht;", ""  ]
-[ "json",  "dump", "pattern json.dump(X_1:json):void ","JSONdump;",
""  ]
+[ "json",  "dump", "pattern json.dump(X_1:json):bat[:str] ",   
"JSONdump;",""  ]
 [ "json",  "filter",   "command json.filter(X_1:json, X_2:str):json ", 
"JSONfilter;",  ""  ]
 [ "json",  "filter",   "command json.filter(X_1:json, X_2:bte, 
X_3:str):json ","JSONfilterArrayDefault_bte;",  ""  ]
 [ "json",  "filter",   "command json.filter(X_1:json, X_2:hge, 
X_3:str):json ","JSONfilterArrayDefault_hge;",  ""  ]
diff --git a/geom/BugTracker/Tests/X_crash.SF-1971632.test 
b/geom/BugTracker/Tests/X_crash.SF-1971632.test
--- a/geom/BugTracker/Tests/X_crash.SF-1971632.test
+++ b/geom/BugTracker/Tests/X_crash.SF-1971632.test
@@ -29,3 +29,4 @@ DROP TABLE geoms
 
 statement ok
 set optimizer = 'default_pipe'
+
diff --git a/geom/BugTracker/Tests/copy_into_crash.SF-1975402.test 
b/geom/BugTracker/Tests/copy_into_crash.SF-1975402.test
--- a/geom/BugTracker/Tests/copy_into_crash.SF-1975402.test
+++ b/geom/BugTracker/Tests/copy_into_crash.SF-1975402.test
@@ -12,4 +12,3 @@ 45111956, \'POINT(52.0697 4.3723)\'
 statement ok
 drop table nodes
 
-
diff --git a/geom/sql/conformance/Tests/T1.test 
b/geom/sql/conformance/Tests/T1.test
--- a/geom/sql/conformance/Tests/T1.test
+++ b/geom/sql/conformance/Tests/T1.test
@@ -1,6 +1,15 @@
 query T rowsort
 SELECT f_table_name FROM geometry_columns ORDER BY f_table_name
 
-11 values hashing to c4c2fd32627fe8478eeeb74c8a76c7c7
+bridges
+buildings
+buildings
+divided_routes
+forests
+lakes
+map_neatlines
+named_places
+ponds
+road_segments
+streams
 
-
diff --git a/geom/sql/conformance/Tests/T10.test 
b/geom/sql/conformance/Tests/T10.test
--- a/geom/sql/conformance/Tests/T10.test
+++ b/geom/sql/conformance/Tests/T10.test
@@ -3,4 +3,3 @@ SELECT ST_SRID(boundary) FROM named_plac
 
 101
 
-
diff --git 

MonetDB: nospare - merged

2021-02-04 Thread Niels Nes
Changeset: 3bd06ed5cce4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3bd06ed5cce4
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_scenario.c
sql/server/rel_select.c
Branch: nospare
Log Message:

merged


diffs (truncated from 324 to 300 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
@@ -2740,7 +2740,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
const char *rnme = table_name(sql->sa, c);
const char *nme = column_name(sql->sa, c);
 
-   if (l_is_base && nme[0] == '%' && strcmp(nme, TID) == 0)
+   if (semijoin_only && l_is_base && nme[0] == '%' && strcmp(nme, 
TID) == 0)
s = join;
else
s = stmt_project(be, join, column(be, c));
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
@@ -801,12 +801,13 @@ create_func(mvc *sql, char *sname, char 
 
FUNC_TYPE_STR(f->type, F, fn)
 
-   (void) fname;
(void) fn;
if (!(s = mvc_bind_schema(sql, sname)))
throw(SQL,"sql.create_func", SQLSTATE(3F000) "CREATE %s: no 
such schema '%s'", F, sname);
if (!mvc_schema_privs(sql, s))
throw(SQL,"sql.create_func", SQLSTATE(42000) "CREATE %s: access 
denied for %s to schema '%s'", F, get_string_global_var(sql, "current_user"), 
s->base.name);
+   if (strlen(fname) >= IDLENGTH)
+   throw(SQL,"sql.create_func", SQLSTATE(42000) "CREATE %s: name 
'%s' too large for the backend", F, fname);
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);
switch (nf->lang) {
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
@@ -141,6 +141,14 @@ static int
int res = 0;
str msg = MAL_SUCCEED;
 
+   if (strlen(mod) >= IDLENGTH) {
+   (void) sql_error(m, 02, SQLSTATE(42000) "Module name '%s' too 
large for the backend", mod);
+   return -1;
+   }
+   if (strlen(name) >= IDLENGTH) {
+   (void) sql_error(m, 02, SQLSTATE(42000) "Function name '%s' too 
large for the backend", name);
+   return -1;
+   }
backup = c->curprg;
curPrg = c->curprg = newFunction(putName(mod), putName(name), 
FUNCTIONsymbol);
if( curPrg == NULL) {
@@ -181,7 +189,10 @@ static int
sql_error(m, 001, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
return -1;
}
-   varid = newVariable(curBlk, buf, strlen(buf), type);
+   if ((varid = newVariable(curBlk, buf, strlen(buf), 
type)) < 0) {
+   sql_error(m, 003, SQLSTATE(42000) "Internal 
error while compiling statement: variable id too long");
+   return -1;
+   }
curInstr = pushArgument(curBlk, curInstr, varid);
setVarType(curBlk, varid, type);
}
@@ -209,7 +220,10 @@ static int
sql_error(m, 001, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
return -1;
}
-   varid = newVariable(curBlk, (char *)buf, strlen(buf), 
type);
+   if ((varid = newVariable(curBlk, (char *)buf, 
strlen(buf), type)) < 0) {
+   sql_error(m, 003, SQLSTATE(42000) "Internal 
error while compiling statement: variable id too long");
+   return -1;
+   }
curInstr = pushArgument(curBlk, curInstr, varid);
setVarType(curBlk, varid, type);
}
@@ -306,6 +320,14 @@ static int
sql_error(m, 003, SQLSTATE(42000) "Missing property on the 
input relation");
return -1;
}
+   if (strlen(mod) >= IDLENGTH) {
+   sql_error(m, 003, SQLSTATE(42000) "Module name '%s' too large 
for the backend", mod);
+   return -1;
+   }
+   if (strlen(name) >= IDLENGTH) {
+   sql_error(m, 003, SQLSTATE(42000) "Function name '%s' too large 
for the backend", name);
+   return -1;
+   }
 
lname = GDKstrdup(name);
if (lname == NULL) {
@@ -367,7 +389,11 @@ static int
return -1;
}
stpcpy(stpcpy(buf, "A"), nme);
-  

MonetDB: nospare - merged

2021-02-03 Thread Niels Nes
Changeset: ab54756698f0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ab54756698f0
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk_logger.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_upgrades.c
sql/backends/monet5/vaults/fits/fits.c
sql/backends/monet5/wlr.c
sql/server/rel_optimizer.c
sql/server/rel_unnest.c
sql/server/rel_updates.c
sql/storage/bat/bat_logger.c
sql/storage/store.c
sql/test/SQLancer/Tests/sqlancer07.test
Branch: nospare
Log Message:

merged


diffs (truncated from 4756 to 300 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,8 +69,10 @@ monetdb_configure_defines()
 if(HAVE_NETDB_H)
   set(CMAKE_EXTRA_INCLUDE_FILES "netdb.h" "unistd.h")
 endif()
-if(HAVE_WINSOCK_H)
-  set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h")
+if(NOT HAVE_SYS_SOCKET_H)
+  if(HAVE_WINSOCK_H)
+set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h")
+  endif()
 endif()
 set(CMAKE_REQUIRED_INCLUDES "/usr/include")
 
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -336,16 +336,25 @@ size_t HEAPmemsize(Heap *h);
 size_t HEAPvmsize(Heap *h);
 void IMPSdestroy(BAT *b);
 lng IMPSimprintsize(BAT *b);
+int MT_access(const char *pathname, int mode);
 int MT_check_nr_cores(void);
 int MT_create_thread(MT_Id *t, void (*function)(void *), void *arg, enum 
MT_thr_detach d, const char *threadname);
 void MT_exiting_thread(void);
+FILE *MT_fopen(const char *filename, const char *mode);
+char *MT_getcwd(char *buffer, size_t size);
 MT_Id MT_getpid(void);
 size_t MT_getrss(void);
 void MT_init(void);
 int MT_join_thread(MT_Id t);
-int MT_lockf(char *filename, int mode);
+int MT_lockf(const char *filename, int mode);
+int MT_mkdir(const char *dirname);
+int MT_open(const char *filename, int flags);
 bool MT_path_absolute(const char *path);
+int MT_remove(const char *filename);
+int MT_rename(const char *old, const char *new);
+int MT_rmdir(const char *dirname);
 void MT_sleep_ms(unsigned int ms);
+int MT_stat(const char *filename, struct stat *stb);
 const char *MT_thread_getalgorithm(void);
 void *MT_thread_getdata(void);
 const char *MT_thread_getname(void);
@@ -562,12 +571,9 @@ ssize_t timestamp_precision_tostr(str *b
 ssize_t timestamp_tostr(str *buf, size_t *len, const timestamp *val, bool 
external);
 ssize_t timestamp_tz_fromstr(const char *buf, size_t *len, timestamp **ret, 
bool external);
 const timestamp unixepoch;
+wchar_t *utf8towchar(const char *src);
 gdk_return void_inplace(BAT *b, oid id, const void *val, bool force) 
__attribute__((__warn_unused_result__));
-int win_mkdir(const char *, const int mode);
-int win_rename(const char *, const char *);
-int win_rmdir(const char *);
-int win_stat(const char *, struct stat *);
-int win_unlink(const char *);
+char *wchartoutf8(const wchar_t *src);
 int winerror(int);
 
 # mapi
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1939,7 +1939,7 @@ format_result(Mapi mid, MapiHdl hdl, boo
if (timerHumanCalled)
timerHuman(sqloptimizer, maloptimizer, querytime, singleinstr, 
true);
if (mnstr_errnr(toConsole)) {
-   fprintf(stderr, "write error: %s\n", 
mnstr_peek_error(toConsole));
+   mnstr_printf(stderr_stream, "write error: %s\n", 
mnstr_peek_error(toConsole));
mnstr_clearerr(toConsole);
errseen = true;
}
@@ -2020,7 +2020,7 @@ doFileBulk(Mapi mid, stream *fp)
bufsize = 10240;
buf = malloc(bufsize + 1);
if (!buf) {
-   fprintf(stderr, "cannot allocate memory for send buffer\n");
+   mnstr_printf(stderr_stream, "cannot allocate memory for send 
buffer\n");
if (fp)
close_stream(fp);
return true;
@@ -2043,7 +2043,7 @@ doFileBulk(Mapi mid, stream *fp)
} else {
buf[length] = 0;
if (strlen(buf) < (size_t) length) {
-   fprintf(stderr, "NULL byte in input\n");
+   mnstr_printf(stderr_stream, "NULL byte in 
input\n");
errseen = true;
break;
}
@@ -2235,7 +2235,7 @@ doFile(Mapi mid, stream *fp, bool useins
rl.s = fp;
rl.buf = NULL;
if ((fp = callback_stream(, myread, NULL, NULL, mydestroy, 
mnstr_name(fp))) == NULL) {
-   fprintf(stderr,"Malloc for doFile failed");
+   mnstr_printf(stderr_stream,"Malloc for doFile failed");
exit(2);
}
 #endif
@@ 

MonetDB: nospare - merged

2021-02-03 Thread Niels Nes
Changeset: 74eda1eba069 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=74eda1eba069
Branch: nospare
Log Message:

merged


diffs (12 lines):

diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -4861,7 +4861,7 @@ sql_trans_create_table(sql_trans *tr, sq
t->sz = COLSIZE;
if (isGlobal(t)) {
if (os_add(s->tables, tr, t->base.name, >base)) {
-   table_destroy(store, t);
+   //table_destroy(store, t);
return NULL;
}
} else
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: nospare - merged

2021-02-02 Thread Niels Nes
Changeset: 94bd88d5484e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=94bd88d5484e
Branch: nospare
Log Message:

merged


diffs (51 lines):

diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -12,13 +12,7 @@
 
 #include "gdk_atoms.h"
 
-
-/* TODO
- * implement new double linked list
- * keep hash/map of names -> objectversion
- */
-
-struct versionhead ;// TODO: rename to object_version_chain
+struct versionhead ;
 
 #define active (0)
 #define id_based_rollbacked(1)
@@ -109,7 +103,6 @@ find_id(objectset *os, sqlid id)
return NULL;
}
MT_lock_unset(>ht_lock);
-   // TODO: can we actually reach this point?
for (versionhead  *n = os->id_based_h; n; n = n->next) {
objectversion *ov = n->ov;
 
@@ -145,7 +138,7 @@ node_destroy(objectset *os, sqlstore *st
 {
if (!os->sa)
_DELETE(n);
-   (void)store; /* todo destroy b */
+   (void)store;
 }
 
 static versionhead  *
@@ -663,7 +656,6 @@ find_name(objectset *os, const char *nam
return NULL;
}
MT_lock_unset(>ht_lock);
-   // TODO: can we actually reach this point?
for (versionhead  *n = os->name_based_h; n; n = n->next) {
objectversion *ov = n->ov;
 
@@ -676,7 +668,6 @@ find_name(objectset *os, const char *nam
return NULL;
 }
 
-
 static objectversion*
 get_valid_object_name(sql_trans *tr, objectversion *ov)
 {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: nospare - merged

2021-01-30 Thread Niels Nes
Changeset: c34cc41ca842 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c34cc41ca842
Branch: nospare
Log Message:

merged


diffs (97 lines):

diff --git a/sql/test/mergetables/Tests/All b/sql/test/mergetables/Tests/All
--- a/sql/test/mergetables/Tests/All
+++ b/sql/test/mergetables/Tests/All
@@ -28,3 +28,4 @@ sqlsmith-exists
 sqlsmith-exists2
 
 mergetable_rel_push_aggr_down
+multiple-merge-tables
diff --git a/sql/test/mergetables/Tests/multiple-merge-tables.test 
b/sql/test/mergetables/Tests/multiple-merge-tables.test
new file mode 100644
--- /dev/null
+++ b/sql/test/mergetables/Tests/multiple-merge-tables.test
@@ -0,0 +1,84 @@
+statement ok
+create table t (i int)
+
+statement ok
+insert into t values (42), (666)
+
+statement ok
+create merge table mt1 (like t)
+
+statement ok
+create merge table mt2 (like t)
+
+statement ok
+create temp table mycount(cc BIGINT) ON COMMIT PRESERVE ROWS
+
+statement ok
+insert into mycount SELECT (SELECT COUNT(*) FROM sys.dependencies) + (SELECT 
COUNT(*) FROM sys.objects)
+
+statement ok
+alter table mt1 add table t
+
+query I rowsort
+select i from mt1
+
+42
+666
+
+statement error
+select i from mt2
+
+statement ok
+alter table mt2 add table t
+
+query I rowsort
+select i from mt1
+
+42
+666
+
+query I rowsort
+select i from mt2
+
+42
+666
+
+statement ok
+alter table mt1 drop table t
+
+statement error
+select i from mt1
+
+query I rowsort
+select i from mt2
+
+42
+666
+
+statement ok
+alter table mt2 drop table t
+
+statement error
+select i from mt1
+
+statement error
+select i from mt2
+
+query I rowsort
+SELECT CAST((SELECT COUNT(*) FROM sys.dependencies) + (SELECT COUNT(*) FROM 
sys.objects) - (SELECT cc FROM mycount) AS BIGINT)
+
+0
+
+statement ok
+drop table mycount
+
+statement ok
+drop table mt1
+
+statement ok
+drop table mt2
+
+statement ok
+drop table t
+
+
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: nospare - merged

2021-01-27 Thread Niels Nes
Changeset: a229571dcbf6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a229571dcbf6
Branch: nospare
Log Message:

merged


diffs (179 lines):

diff --git a/sql/common/sql_hash.c b/sql/common/sql_hash.c
--- a/sql/common/sql_hash.c
+++ b/sql/common/sql_hash.c
@@ -30,7 +30,11 @@ hash_new(sql_allocator *sa, int size, fk
ht->sa = sa;
ht->size = (1buckets = (ht->sa)?SA_NEW_ARRAY(sa, sql_hash_e*, 
ht->size):NEW_ARRAY(sql_hash_e*, ht->size);
+   ht->buckets = (ht->sa)?SA_NEW_ARRAY(sa, sql_hash_e*, 
ht->size):NEW_ARRAY(sql_hash_e*, ht->size); // TODO: can fail
+   if (ht->buckets == NULL) {
+   _DELETE(ht);
+   return NULL;
+   }
for (int i = 0; i < ht->size; i++)
ht->buckets[i] = NULL;
return ht;
diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -76,7 +76,7 @@ find_id(objectset *os, sqlid id)
if (os) {
MT_lock_set(>ht_lock);
if ((!os->id_map || os->id_map->size*16 < os->id_based_cnt) && 
os->id_based_cnt > HASH_MIN_SIZE && os->sa) {
-   // TODO: This leaks the old map
+   hash_destroy(os->id_map);
os->id_map = hash_new(os->sa, os->id_based_cnt, 
(fkeyvalue)_id_key);
if (os->id_map == NULL) {
MT_lock_unset(>ht_lock);
@@ -225,8 +225,18 @@ node_create(sql_allocator *sa, objectver
 }
 
 static objectset *
+
 os_append_node_name(objectset *os, versionhead  *n)
 {
+   MT_lock_set(>ht_lock);
+   if (os->name_map) {
+   int key = os->name_map->key(n);
+
+   if (hash_add(os->name_map, key, n) == NULL) {
+   MT_lock_unset(>ht_lock);
+   return NULL;
+   }
+   }
if (os->name_based_t) {
os->name_based_t->next = n;
} else {
@@ -234,18 +244,7 @@ os_append_node_name(objectset *os, versi
}
n->prev = os->name_based_t; // aka the double linked list.
os->name_based_t = n;
-   if (n->ov) {
-   MT_lock_set(>ht_lock);
-   if (os->name_map) {
-   int key = os->name_map->key(n);
-
-   if (hash_add(os->name_map, key, n) == NULL) {
-   MT_lock_unset(>ht_lock);
-   return NULL;
-   }
-   }
-   MT_lock_unset(>ht_lock);
-   }
+   MT_lock_unset(>ht_lock);
os->name_based_cnt++;
return os;
 }
@@ -259,12 +258,26 @@ os_append_name(objectset *os, objectvers
return NULL;
 
ov->name_based_head = n;
-   return os_append_node_name(os, n);
+   if (!(os = os_append_node_name(os, n))){
+   _DELETE(n);
+   return NULL;
+   }
+
+   return os;
 }
 
 static objectset *
 os_append_node_id(objectset *os, versionhead  *n)
 {
+   MT_lock_set(>ht_lock);
+   if (os->id_map) {
+   int key = os->id_map->key(n);
+
+   if (hash_add(os->id_map, key, n) == NULL) {
+   MT_lock_unset(>ht_lock);
+   return NULL;
+   }
+   }
if (os->id_based_t) {
os->id_based_t->next = n;
} else {
@@ -272,18 +285,7 @@ os_append_node_id(objectset *os, version
}
n->prev = os->id_based_t; // aka the double linked list.
os->id_based_t = n;
-   if (n->ov) {
-   MT_lock_set(>ht_lock);
-   if (os->id_map) {
-   int key = os->id_map->key(n);
-
-   if (hash_add(os->id_map, key, n) == NULL) {
-   MT_lock_unset(>ht_lock);
-   return NULL;
-   }
-   }
-   MT_lock_unset(>ht_lock);
-   }
+   MT_lock_unset(>ht_lock);
os->id_based_cnt++;
return os;
 }
@@ -296,7 +298,12 @@ os_append_id(objectset *os, objectversio
if (n == NULL)
return NULL;
ov->id_based_head = n;
-   return os_append_node_id(os, n);
+   if (!(os = os_append_node_id(os, n))){
+   _DELETE(n);
+   return NULL;
+   }
+
+   return os;
 }
 
 static versionhead * find_name(objectset *os, const char *name);
@@ -610,7 +617,7 @@ find_name(objectset *os, const char *nam
if (os) {
MT_lock_set(>ht_lock);
if ((!os->name_map || os->name_map->size*16 < 
os->name_based_cnt) && os->name_based_cnt > HASH_MIN_SIZE && os->sa) {
-   // TODO: This leaks the old map
+   hash_destroy(os->name_map);
os->name_map = hash_new(os->sa, os->name_based_cnt, 
(fkeyvalue)_name_key);
if 

MonetDB: nospare - merged ... oh so fun

2021-01-27 Thread Niels Nes
Changeset: f1c867abfc60 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f1c867abfc60
Modified Files:
clients/Tests/MAL-signatures.stable.out
clients/Tests/MAL-signatures.stable.out.int128
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_cat.c
sql/server/rel_optimizer.c
sql/server/rel_schema.c
sql/test/SQLancer/Tests/sqlancer03.test
sql/test/SQLancer/Tests/sqlancer07.test
Branch: nospare
Log Message:

merged ... oh so fun


diffs (truncated from 1918 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -363,6 +363,7 @@ developer.
 %files client-tests
 %defattr(-,root,root)
 %{_bindir}/arraytest
+%{_bindir}/bincopydata
 %{_bindir}/odbcsample1
 %{_bindir}/sample0
 %{_bindir}/sample1
@@ -681,7 +682,11 @@ developer, but if you do want to test, t
 
 %files testing-python
 %defattr(-,root,root)
+%{_bindir}/Mconvert.py
 %{_bindir}/Mtest.py
+%{_bindir}/Mz.py
+%{_bindir}/mktest.py
+%{_bindir}/sqllogictest.py
 %dir %{python3_sitelib}/MonetDBtesting
 %{python3_sitelib}/MonetDBtesting/*
 
diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -9514,19 +9514,19 @@ stdout of test 'MAL-signatures` in direc
 [ "sqlcatalog","comment_on",   "pattern sqlcatalog.comment_on(X_1:int, 
X_2:str):void ","SQLcomment_on;",   ""  ]
 [ "sqlcatalog","create_function",  "pattern 
sqlcatalog.create_function(X_1:str, X_2:str, X_3:ptr):void ",  
"SQLcreate_function;",  ""  ]
 [ "sqlcatalog","create_role",  "pattern 
sqlcatalog.create_role(X_1:str, X_2:str, X_3:int):void ",  
"SQLcreate_role;",  ""  ]
-[ "sqlcatalog","create_schema","pattern 
sqlcatalog.create_schema(X_1:str, X_2:str, X_3:int, X_4:int):void ",   
"SQLcreate_schema;",""  ]
+[ "sqlcatalog","create_schema","pattern 
sqlcatalog.create_schema(X_1:str, X_2:str, X_3:int):void ",
"SQLcreate_schema;",""  ]
 [ "sqlcatalog","create_seq",   "pattern sqlcatalog.create_seq(X_1:str, 
X_2:str, X_3:ptr, X_4:int):void ",  "SQLcreate_seq;",   ""  ]
 [ "sqlcatalog","create_table", "pattern 
sqlcatalog.create_table(X_1:str, X_2:str, X_3:ptr, X_4:int):void ",
"SQLcreate_table;", ""  ]
 [ "sqlcatalog","create_trigger",   "pattern 
sqlcatalog.create_trigger(X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int, 
X_7:str, X_8:str, X_9:str, X_10:str):void ",   "SQLcreate_trigger;",   ""  ]
 [ "sqlcatalog","create_type",  "pattern 
sqlcatalog.create_type(X_1:str, X_2:str, X_3:str):void ",  
"SQLcreate_type;",  ""  ]
 [ "sqlcatalog","create_user",  "pattern 
sqlcatalog.create_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str, 
X_6:str):void ",   "SQLcreate_user;",  ""  ]
 [ "sqlcatalog","create_view",  "pattern 
sqlcatalog.create_view(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", 
"SQLcreate_view;",  ""  ]
-[ "sqlcatalog","drop_constraint",  "pattern 
sqlcatalog.drop_constraint(X_1:str, X_2:str, X_3:int, X_4:int):void ", 
"SQLdrop_constraint;",  ""  ]
+[ "sqlcatalog","drop_constraint",  "pattern 
sqlcatalog.drop_constraint(X_1:str, X_2:str, X_3:str, X_4:int, X_5:int):void ", 
   "SQLdrop_constraint;",  ""  ]
 [ "sqlcatalog","drop_function","pattern 
sqlcatalog.drop_function(X_1:str, X_2:str, X_3:int, X_4:int, X_5:int):void ",  
"SQLdrop_function;",""  ]
 [ "sqlcatalog","drop_index",   "pattern sqlcatalog.drop_index(X_1:str, 
X_2:str, X_3:int):void ",   "SQLdrop_index;",   ""  ]
 [ "sqlcatalog","drop_role","pattern sqlcatalog.drop_role(X_1:str, 
X_2:int):void ", "SQLdrop_role;",""  ]
 [ "sqlcatalog","drop_role","pattern sqlcatalog.drop_role(X_1:str, 
X_2:str, X_3:int):void ","SQLdrop_role;",""  ]
-[ "sqlcatalog","drop_schema",  "pattern 
sqlcatalog.drop_schema(X_1:str, X_2:str, X_3:int, X_4:int):void ", 
"SQLdrop_schema;",  ""  ]
+[ "sqlcatalog","drop_schema",  "pattern 
sqlcatalog.drop_schema(X_1:str, X_2:int, X_3:int):void ",  
"SQLdrop_schema;",  ""  ]
 [ "sqlcatalog","drop_seq", "pattern sqlcatalog.drop_seq(X_1:str, 
X_2:str, X_3:int):void ", "SQLdrop_seq;", ""  ]
 [ "sqlcatalog","drop_table",   "pattern sqlcatalog.drop_table(X_1:str, 
X_2:str, X_3:int, X_4:int):void ",  "SQLdrop_table;",   ""  ]
 [ "sqlcatalog","drop_trigger", "pattern 
sqlcatalog.drop_trigger(X_1:str, X_2:str, X_3:int):void ", 
"SQLdrop_trigger;", ""  ]
@@ -9693,7 +9693,7 @@ stdout of test 'MAL-signatures` in direc
 [ "wlc",   "commit",   "pattern wlc.commit():void ",   

MonetDB: nospare - merged

2021-01-26 Thread Niels Nes
Changeset: c484c1dd579f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c484c1dd579f
Branch: nospare
Log Message:

merged


diffs (176 lines):

diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -321,45 +321,20 @@ static void os_atmc_set_state(objectvers
ov->state = state;
 }
 
-static void os_rollback_id_based_terminal_decendant(objectversion *ov, 
sqlstore *store);
-static void os_rollback_name_based_terminal_decendant(objectversion *ov, 
sqlstore *store);
-
 static void
-os_rollback_os_id_based_cascading(objectversion *ov, sqlstore *store) {
-   bte state = os_atmc_get_state(ov);
-   assert(state & id_based_rollbacked);
-
-   if (ov->id_based_older) {
-   if (ov->ts != ov->id_based_older->ts) {
-   // older is last committed state or belongs to parent 
transaction.
-   // In any case, we restore versionhead pointer to that.
-   // TODO START ATOMIC SET
-   ov->id_based_head->ov = ov->id_based_older;
-   }
-   else {
-   if (!(state & name_based_rollbacked))
-   
os_rollback_name_based_terminal_decendant(ov->name_based_head->ov, store);
-   state = os_atmc_get_state(ov->id_based_older);
+_os_rollback(objectversion *ov, sqlstore *store)
+{
+   assert(ov->ts >= TRANSACTION_ID_BASE);
 
-   state |= id_based_rollbacked;
-   os_atmc_set_state(ov->id_based_older, state);
-
-   // id based cascaded rollback along the parents
-   os_rollback_os_id_based_cascading(ov->id_based_older, 
store);
-   }
+   bte state = os_atmc_get_state(ov);
+   if (state & under_destruction) {
+   return;
}
-   else {
-   // this is a terminal node. i.e. this objectversion does not 
have id based committed history
-   os_remove_id_based_chain(ov->os, store, ov->id_based_head);
-   }
-}
 
-static void
-os_rollback_os_name_based_cascading(objectversion *ov, sqlstore *store) {
-   bte state = os_atmc_get_state(ov);
-   assert(state & name_based_rollbacked);
+   state |= under_destruction;
+   os_atmc_set_state(ov, state);
 
-   if (ov->name_based_older) {
+   if (ov->name_based_older && !(os_atmc_get_state(ov->name_based_older) & 
under_destruction)) {
if (ov->ts != ov->name_based_older->ts) {
// older is last committed state or belongs to parent 
transaction.
// In any case, we restore versionhead pointer to that.
@@ -367,69 +342,43 @@ os_rollback_os_name_based_cascading(obje
ov->name_based_head->ov = ov->name_based_older;
}
else {
-   if (!(state & id_based_rollbacked))
-   
os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, store);
-   state = os_atmc_get_state(ov->name_based_older);
-
-   state |= name_based_rollbacked;
-   os_atmc_set_state(ov->name_based_older, state);
-
-   // name based cascaded rollback along the parents
-   
os_rollback_os_name_based_cascading(ov->name_based_older, store);
+   _os_rollback(ov->name_based_older, store);
}
}
-   else {
+   else if (!ov->name_based_older) {
// this is a terminal node. i.e. this objectversion does not 
have name based committed history
-   os_remove_name_based_chain(ov->os, store, ov->name_based_head);
-   }
-}
-
-static void
-os_rollback_name_based_terminal_decendant(objectversion *ov, sqlstore *store)
-{
-   assert(ov->ts >= TRANSACTION_ID_BASE);
-
-   bte state = os_atmc_get_state(ov);
-   if (state & name_based_rollbacked) {
-   return;
+   if (ov->name_based_head) // The oposite can happen during an 
early conflict in os_add or os_del.
+   os_remove_name_based_chain(ov->os, store, 
ov->name_based_head);
}
 
-   state |= name_based_rollbacked;
-   os_atmc_set_state(ov, state);
-
-   if (!(state & id_based_rollbacked))
-   os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, 
store);
-
-   os_rollback_os_name_based_cascading(ov, store);
-}
-
-static void
-os_rollback_id_based_terminal_decendant(objectversion *ov, sqlstore *store)
-{
-   assert(ov->ts >= TRANSACTION_ID_BASE);
-
-   bte state = os_atmc_get_state(ov);
-   if (state & id_based_rollbacked) {
-   return;
+   if (ov->id_based_older && !(os_atmc_get_state(ov->id_based_older) & 
under_destruction)) {
+   if (ov->ts != ov->id_based_older->ts) {
+  

MonetDB: nospare - merged with default

2021-01-23 Thread Niels Nes
Changeset: 66a035b83ecd for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=66a035b83ecd
Modified Files:
sql/server/rel_optimizer.c
Branch: nospare
Log Message:

merged with default


diffs (87 lines):

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
@@ -1363,7 +1363,7 @@ can_push_func(sql_exp *e, sql_rel *rel, 
int mustl = 0, mustr = 0, mustf = 0;
sql_exp *l = e->l, *r = e->r, *f = e->f;
 
-   if (is_project(rel->op) || e->flag == cmp_or || e->flag == 
cmp_in || e->flag == cmp_notin || e->flag == cmp_filter)
+   if ((is_project(rel->op) && e->f) || e->flag == cmp_or || 
e->flag == cmp_in || e->flag == cmp_notin || e->flag == cmp_filter)
return 0;
return ((l->type == e_column || can_push_func(l, rel, )) 
&& (*must = mustl)) ||
(!f && (r->type == e_column || can_push_func(r, 
rel, )) && (*must = mustr)) ||
@@ -1398,17 +1398,20 @@ can_push_func(sql_exp *e, sql_rel *rel, 
 }
 
 static int
-exps_can_push_func(list *exps, sql_rel *rel)
-{
-   for(node *n = exps->h; n; n = n->next) {
+exps_can_push_func(list *exps, sql_rel *rel, bool *push_left, bool *push_right)
+{
+   for(node *n = exps->h; n && !*push_left && !*push_right; n = n->next) {
sql_exp *e = n->data;
-   int must = 0, mustl = 0, mustr = 0;
-
-   if (is_joinop(rel->op) && ((can_push_func(e, rel->l, ) && 
mustl) || (can_push_func(e, rel->r, ) && mustr)))
-   return 1;
-   else if (is_select(rel->op) && can_push_func(e, rel->l, ) 
&& must)
-   return 1;
-   }
+   int mustl = 0, mustr = 0;
+
+   if ((is_joinop(rel->op) || is_select(rel->op)) && 
((can_push_func(e, rel->l, ) && mustl)))
+   *push_left = true;
+   
+   if (is_joinop(rel->op) && can_push_func(e, rel->r, ) && 
mustr)
+   *push_right = true;
+   }
+   if (*push_left || *push_right)
+   return 1;
return 0;
 }
 
@@ -1522,19 +1525,20 @@ rel_push_func_down(visitor *v, sql_rel *
if ((is_select(rel->op) || is_joinop(rel->op)) && rel->l && rel->exps 
&& !(rel_is_ref(rel))) {
list *exps = rel->exps;
sql_rel *l = rel->l, *r = rel->r;
+   bool push_left = false, push_right = false;
 
/* only push down when is useful */
if ((is_select(rel->op) && list_length(rel->exps) <= 1) || 
rel_is_ref(l) || (is_joinop(rel->op) && rel_is_ref(r)))
return rel;
-   if (exps_can_push_func(exps, rel) && exps_need_push_down(exps)) 
{
+   if (exps_can_push_func(exps, rel, _left, _right) && 
exps_need_push_down(exps)) {
sql_rel *nrel, *ol = l, *or = r;
visitor nv = { .sql = v->sql, .parent = v->parent, 
.value_based_opt = v->value_based_opt, .storage_based_opt = 
v->storage_based_opt };
 
/* we need a full projection, group by's and unions 
cannot be extended
 * with more expressions */
-   if (!is_simple_project(l->op) || !l->l)
+   if (push_left && (!is_simple_project(l->op) || !l->l))
rel->l = l = rel_project(v->sql->sa, l, 
rel_projections(v->sql, l, NULL, 1, 1));
-   if (is_joinop(rel->op) && (!is_simple_project(r->op) || 
!r->l))
+   if (push_right && (!is_simple_project(r->op)|| !r->l))
rel->r = r = rel_project(v->sql->sa, r, 
rel_projections(v->sql, r, NULL, 1, 1));
nrel = rel_project(v->sql->sa, rel, 
rel_projections(v->sql, rel, NULL, 1, 1));
 
@@ -1553,14 +1557,15 @@ rel_push_func_down(visitor *v, sql_rel *
}
if (is_simple_project(rel->op) && rel->l && rel->exps) {
sql_rel *pl = rel->l;
-
-   if (is_joinop(pl->op) && exps_can_push_func(rel->exps, rel)) {
+   bool push_left = false, push_right = false;
+
+   if (is_joinop(pl->op) && exps_can_push_func(rel->exps, rel, 
_left, _right)) {
sql_rel *l = pl->l, *r = pl->r;
list *nexps = new_exp_list(v->sql->sa);
 
-   if (!is_simple_project(l->op) || !l->l)
+   if (push_left && !is_simple_project(l->op))
pl->l = l = rel_project(v->sql->sa, l, 
rel_projections(v->sql, l, NULL, 1, 1));
-   if (is_joinop(rel->op) && (!is_simple_project(r->op) || 
!r->l))
+   if (push_right && !is_simple_project(r->op))
pl->r = r = rel_project(v->sql->sa, r, 
rel_projections(v->sql, r, NULL, 

MonetDB: nospare - merged with default

2021-01-22 Thread Niels Nes
Changeset: 64dac3481048 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=64dac3481048
Branch: nospare
Log Message:

merged with default


diffs (truncated from 371 to 300 lines):

diff --git a/sql/test/BugTracker-2009/dumping_tables.SF-2776908.sql 
b/sql/test/BugTracker-2009/dumping_tables.SF-2776908.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2009/dumping_tables.SF-2776908.sql
@@ -0,0 +1,8 @@
+\d
+\d triggers
+\d args
+create table node_tags (id integer);
+select * from node_tags;
+insert into node_tags values (1);
+select * from node_tags;
+drop table node_tags;
diff --git a/sql/test/BugTracker-2017/Tests/insert_self_ref_FK.Bug-6131.test 
b/sql/test/BugTracker-2017/Tests/insert_self_ref_FK.Bug-6131.test
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/insert_self_ref_FK.Bug-6131.test
@@ -0,0 +1,114 @@
+statement ok
+CREATE TABLE test101(
+  A INT NOT NULL PRIMARY KEY,
+  B INT NOT NULL,
+  C INT NOT NULL,
+  CONSTRAINT "fC" FOREIGN KEY (C) REFERENCES test101(A)
+)
+
+statement ok
+INSERT INTO test101 VALUES (101, 101, 101)
+
+statement ok
+ALTER TABLE test101 ALTER C SET NULL
+
+statement ok
+INSERT INTO test101 VALUES (100, 100, NULL)
+
+statement ok
+INSERT INTO test101 VALUES (102, 102, 102)
+
+statement ok
+INSERT INTO test101 VALUES (103, 103, 101)
+
+statement ok
+UPDATE test101 SET C = 100 WHERE C IS NULL
+
+query III rowsort
+select * from test101
+
+100
+100
+100
+101
+101
+101
+102
+102
+102
+103
+103
+103
+
+statement ok
+ALTER TABLE test101 ALTER C SET NOT NULL
+
+statement ok
+INSERT INTO test101 VALUES (104, 104, 104)
+
+statement ok
+DROP TABLE test101
+
+statement ok
+START TRANSACTION
+
+statement ok
+CREATE TABLE "sys"."t1" ("c0" DOUBLE,CONSTRAINT "t1_c0_unique" UNIQUE 
("c0"),CONSTRAINT "t1_c0_fkey" FOREIGN KEY ("c0") REFERENCES "sys"."t1" ("c0"))
+
+statement ok
+COPY 9 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"'
+
+0.21248182395969406
+0.6307796692265083
+2059310235
+-6.5457821e+08
+0.743704157497456
+0.4001718453135127
+0.3935743494971655
+0.5299192301063729
+0.7609386265982908
+
+statement ok
+ROLLBACK
+
+statement ok
+START TRANSACTION
+
+statement ok
+CREATE TABLE "t0"("tc0" CHARACTER LARGE OBJECT NOT NULL,CONSTRAINT 
"t0_tc0_pkey" PRIMARY KEY ("tc0"),
+CONSTRAINT "t0_tc0_fkey" FOREIGN KEY ("tc0") REFERENCES "sys"."t0" ("tc0"))
+
+statement ok
+INSERT INTO t0(tc0) VALUES('b' BETWEEN 'a' AND 'c')
+
+statement ok
+ROLLBACK
+
+statement ok
+CREATE TABLE t1(c0 FLOAT)
+
+statement ok
+ALTER TABLE t1 ADD UNIQUE(c0)
+
+statement ok
+INSERT INTO t1(c0) VALUES(13.38)
+
+statement ok
+DELETE FROM t1 WHERE true
+
+statement ok
+INSERT INTO t1(c0) VALUES(0.9), (0.5), (-3), (0.4)
+
+statement ok
+ALTER TABLE t1 ADD FOREIGN KEY (c0) REFERENCES t1(c0)
+
+statement ok
+INSERT INTO t1(c0) VALUES(null)
+
+statement ok
+DELETE FROM t1
+
+statement ok
+DROP TABLE t1
+
+
diff --git a/sql/test/Dump/Tests/dump-empty.stable.out 
b/sql/test/Dump/Tests/dump-empty.stable.out
new file mode 100644
--- /dev/null
+++ b/sql/test/Dump/Tests/dump-empty.stable.out
@@ -0,0 +1,34 @@
+stdout of test 'dump-empty` in directory 'sql/test/Dump` itself:
+
+
+# 17:33:41 >  
+# 17:33:41 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31345" "--set" 
"mapi_usock=/var/tmp/mtest-4412/.s.monetdb.31345" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_Dump"
 "--set" "embedded_c=true"
+# 17:33:41 >  
+
+# MonetDB 5 server v11.30.0
+# This is an unreleased version
+# Serving database 'mTests_sql_test_Dump', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 128bit integers
+# Found 15.386 GiB available main-memory.
+# Copyright (c) 1993 - July 2008 CWI.
+# Copyright (c) August 2008 - 2018 MonetDB B.V., all rights reserved
+# Visit https://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://xps13:31345/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-4412/.s.monetdb.31345
+# MonetDB/GIS module loaded
+# SQL catalog created, loading sql scripts once
+
+
+# 10:50:27 >  
+# 10:50:27 >  /usr/bin/python dump-empty.SQL.py dump-empty 
+# 10:50:27 >  
+
+#msqldump tables Wed Sep  8 10:50:27 2010
+
+START TRANSACTION;
+COMMIT;
+
+# 10:50:28 >  
+# 10:50:28 >  Done.
+# 10:50:28 >  
+
diff --git a/sql/test/Triggers/Tests/trigger_action.test 
b/sql/test/Triggers/Tests/trigger_action.test
new file mode 100644
--- /dev/null
+++ b/sql/test/Triggers/Tests/trigger_action.test
@@ -0,0 +1,160 @@
+statement ok
+create table t_4_1 ("id" int, "name" varchar(1024))
+
+statement ok
+insert into t_4_1 values(10, 'monetdb')
+
+statement ok
+insert into t_4_1 values(20, 'monet')
+
+statement ok
+create trigger test_4_1
+   after update on t_4_1 referencing old row as old_row
+   for each statement insert into t_4_1 values(0, 

MonetDB: nospare - merged with default

2021-01-22 Thread Niels Nes
Changeset: 6be408cbaaa7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6be408cbaaa7
Modified Files:
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/rel_updates.c
Branch: nospare
Log Message:

merged with default


diffs (truncated from 645 to 300 lines):

diff --git a/sql/include/sql_relation.h b/sql/include/sql_relation.h
--- a/sql/include/sql_relation.h
+++ b/sql/include/sql_relation.h
@@ -197,7 +197,6 @@ typedef enum operator_type {
 #define is_simple_project(op)  (op == op_project)
 #define is_project(op) (op == op_project || op == op_groupby 
|| is_set(op))
 #define is_groupby(op) (op == op_groupby)
-#define is_sort(rel)   (((rel)->op == op_project && (rel)->r) || 
(rel)->op == op_topn)
 #define is_topn(op)(op == op_topn)
 #define is_modify(op)  (op == op_insert || op == op_update || op == 
op_delete || op == op_truncate)
 #define is_sample(op)  (op == op_sample)
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
@@ -2087,6 +2087,7 @@ rel_push_topn_and_sample_down(visitor *v
ur = func(v->sql->sa, ur, sum_limit_offset(v->sql, 
rel));
 
u = rel_setop(v->sql->sa, ul, ur, op_union);
+   /* TODO the list of expressions of u don't match ul and 
ur */
u->exps = exps_alias(v->sql, r->exps);
u->nrcols = list_length(u->exps);
set_processed(u);
@@ -4111,7 +4112,7 @@ rel_push_aggr_down(visitor *v, sql_rel *
sql_table *mt = (bt)?bt->r:NULL;
if (c && mt && 
list_find(c->t->pkey->k.columns, c, cmp) != NULL) {
v->changes++;
-   return rel_inplace_setop(rel, 
ul, ur, op_union,
+   return 
rel_inplace_setop(v->sql, rel, ul, ur, op_union,
   rel_projections(v->sql, 
rel, NULL, 1, 1));
}
}
@@ -5069,7 +5070,7 @@ rel_push_join_down_union(visitor *v, sql
nl = rel_project(v->sql->sa, nl, 
rel_projections(v->sql, nl, NULL, 1, 1));
nr = rel_project(v->sql->sa, nr, 
rel_projections(v->sql, nr, NULL, 1, 1));
v->changes++;
-   return rel_inplace_setop(rel, nl, nr, op_union, 
rel_projections(v->sql, rel, NULL, 1, 1));
+   return rel_inplace_setop(v->sql, rel, nl, nr, op_union, 
rel_projections(v->sql, rel, NULL, 1, 1));
} else if (is_union(l->op) && !need_distinct(l) &&
   is_union(r->op) && !need_distinct(r)) {
sql_rel *nl, *nr;
@@ -5112,7 +5113,7 @@ rel_push_join_down_union(visitor *v, sql
nl = rel_project(v->sql->sa, nl, 
rel_projections(v->sql, nl, NULL, 1, 1));
nr = rel_project(v->sql->sa, nr, 
rel_projections(v->sql, nr, NULL, 1, 1));
v->changes++;
-   return rel_inplace_setop(rel, nl, nr, op_union, 
rel_projections(v->sql, rel, NULL, 1, 1));
+   return rel_inplace_setop(v->sql, rel, nl, nr, op_union, 
rel_projections(v->sql, rel, NULL, 1, 1));
} else if (!is_union(l->op) &&
   is_union(r->op) && !need_distinct(r) &&
   !is_semi(rel->op)) {
@@ -5141,7 +5142,7 @@ rel_push_join_down_union(visitor *v, sql
nl = rel_project(v->sql->sa, nl, 
rel_projections(v->sql, nl, NULL, 1, 1));
nr = rel_project(v->sql->sa, nr, 
rel_projections(v->sql, nr, NULL, 1, 1));
v->changes++;
-   return rel_inplace_setop(rel, nl, nr, op_union, 
rel_projections(v->sql, rel, NULL, 1, 1));
+   return rel_inplace_setop(v->sql, rel, nl, nr, op_union, 
rel_projections(v->sql, rel, NULL, 1, 1));
/* {semi}join ( A1, union (A2, B)) [A1.partkey = A2.partkey] ->
 * {semi}join ( A1, A2 )
 * and
@@ -5471,7 +5472,7 @@ rel_push_select_down_union(visitor *v, s
ul->exps = exps_copy(v->sql, s->exps);
ur->exps = exps_copy(v->sql, s->exps);
 
-   rel = rel_inplace_setop(rel, ul, ur, op_union, 
rel_projections(v->sql, rel, NULL, 1, 1));
+   rel = rel_inplace_setop(v->sql, rel, ul, ur, op_union, 
rel_projections(v->sql, rel, NULL, 1, 1));
v->changes++;
return rel;
}
@@ -5600,7 +5601,7 @@ rel_push_project_down_union(visitor *v, 
 

MonetDB: nospare - merged with default

2021-01-21 Thread Niels Nes
Changeset: ee1369de5b83 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ee1369de5b83
Branch: nospare
Log Message:

merged with default


diffs (truncated from 1296255 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.sql b/clients/Tests/MAL-signatures.sql
deleted file mode 100644
--- a/clients/Tests/MAL-signatures.sql
+++ /dev/null
@@ -1,1 +0,0 @@
-select * from sys.malfunctions() order by module, "function", address, 
signature, comment;
diff --git a/clients/Tests/MAL-signatures.stable.err 
b/clients/Tests/MAL-signatures.stable.err
deleted file mode 100644
--- a/clients/Tests/MAL-signatures.stable.err
+++ /dev/null
@@ -1,36 +0,0 @@
-stderr of test 'MAL-signatures` in directory 'clients` itself:
-
-
-# 21:33:47 >  
-# 21:33:47 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=35607" "--set" 
"mapi_usock=/var/tmp/mtest-19610/.s.monetdb.35607" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/home/sjoerd/Monet-stable/var/MonetDB/mTests_clients" "--set" 
"mal_listing=2"
-# 21:33:47 >  
-
-# builtin opt  gdk_dbpath = /home/sjoerd/Monet-stable/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 = 35607
-# cmdline opt  mapi_usock = /var/tmp/mtest-19610/.s.monetdb.35607
-# cmdline opt  monet_prompt = 
-# cmdline opt  mal_listing = 2
-# cmdline opt  gdk_dbpath = 
/home/sjoerd/Monet-stable/var/MonetDB/mTests_clients
-# cmdline opt  mal_listing = 2
-
-# 21:33:48 >  
-# 21:33:48 >  "mclient" "-lmal" "-ftest" "-Eutf-8" "-i" "-e" 
"--host=/var/tmp/mtest-19610" "--port=35607"
-# 21:33:48 >  
-
-
-
-# 21:33:51 >  
-# 21:33:51 >  "Done."
-# 21:33:51 >  
-
diff --git a/clients/Tests/exports.stable.err b/clients/Tests/exports.stable.err
deleted file mode 100644
--- a/clients/Tests/exports.stable.err
+++ /dev/null
@@ -1,9 +0,0 @@
-stderr of test 'exports` in directory 'clients` itself:
-
-
-# 15:10:42 >  
-# 15:10:42 >  "/usr/bin/python" "exports.py" "exports"
-# 15:10:42 >  
-
-
-
diff --git a/clients/Tests/exports.stable.err-noapprove 
b/clients/Tests/exports.stable.err-noapprove
deleted file mode 100644
diff --git a/clients/Tests/malcheck.stable.err 
b/clients/Tests/malcheck.stable.err
deleted file mode 100644
--- a/clients/Tests/malcheck.stable.err
+++ /dev/null
@@ -1,12 +0,0 @@
-stderr of test 'malcheck` in directory 'clients` itself:
-
-
-# 15:15:51 >  
-# 15:15:51 >  "./malcheck.sh" "malcheck"
-# 15:15:51 >  
-
-
-# 15:16:26 >  
-# 15:16:26 >  "Done."
-# 15:16:26 >  
-
diff --git a/clients/Tests/malcheck.stable.err-noapprove 
b/clients/Tests/malcheck.stable.err-noapprove
deleted file mode 100644
diff --git a/clients/Tests/malcheck.stable.out 
b/clients/Tests/malcheck.stable.out
deleted file mode 100644
--- a/clients/Tests/malcheck.stable.out
+++ /dev/null
@@ -1,12 +0,0 @@
-stdout of test 'malcheck` in directory 'clients` itself:
-
-
-# 15:15:51 >  
-# 15:15:51 >  "./malcheck.sh" "malcheck"
-# 15:15:51 >  
-
-
-# 15:16:26 >  
-# 15:16:26 >  "Done."
-# 15:16:26 >  
-
diff --git a/clients/Tests/malcheck.stable.out-noapprove 
b/clients/Tests/malcheck.stable.out-noapprove
deleted file mode 100644
diff --git a/clients/ruby/Tests/gemtest.stable.err 
b/clients/ruby/Tests/gemtest.stable.err
deleted file mode 100644
--- a/clients/ruby/Tests/gemtest.stable.err
+++ /dev/null
@@ -1,37 +0,0 @@
-stderr of test 'gemtest` in directory 'clients/ruby` itself:
-
-
-# 11:01:32 >  
-# 11:01:32 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=31445" "--set" 
"mapi_usock=/var/tmp/mtest-29264/.s.monetdb.31445" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/Users/rkoopmanschap/projects/MonetDB-installation/var/MonetDB/mTests_."
 "--set" "mal_listing=0" "--set" "embedded_r=yes"
-# 11:01:32 >  
-
-# builtin opt  gdk_dbpath = 
/Users/rkoopmanschap/projects/MonetDB-installation/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 = 31445
-# cmdline opt  mapi_usock = /var/tmp/mtest-29264/.s.monetdb.31445
-# cmdline opt  monet_prompt = 
-# cmdline opt  mal_listing = 2
-# cmdline opt  gdk_dbpath = 
/Users/rkoopmanschap/projects/MonetDB-installation/var/MonetDB/mTests_.
-# cmdline opt  mal_listing = 0
-# cmdline opt  embedded_r = 

MonetDB: nospare - merged with default

2021-01-21 Thread Niels Nes
Changeset: 6e3074fdb92a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6e3074fdb92a
Branch: nospare
Log Message:

merged with default


diffs (11 lines):

diff --git a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh 
b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh
--- a/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh
+++ b/sql/jdbc/tests/Tests/bogus-auto-generated-keys.SQL.sh
@@ -5,6 +5,6 @@ user=monetdb
 password=monetdb
 EOF
 
-java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d ${TSTDB} -e -f 
\"$TSTSRCBASE/$TSTDIR/Tests/bogus-auto-generated-keys.sql\"
+java nl.cwi.monetdb.client.JdbcClient -h $HOST -p $MAPIPORT -d ${TSTDB} -e -f 
$TSTSRCBASE/$TSTDIR/Tests/bogus-auto-generated-keys.sql
 
 rm -f .monetdb
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: nospare - merged

2021-01-21 Thread Niels Nes
Changeset: f585fa27f65e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f585fa27f65e
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/server/rel_dump.c
sql/server/rel_optimizer.c
sql/server/rel_rel.c
sql/server/rel_select.c
sql/server/rel_unnest.c
sql/server/rel_updates.c
Branch: nospare
Log Message:

merged


diffs (truncated from 776 to 300 lines):

diff --git a/monetdb5/modules/atoms/xml.c b/monetdb5/modules/atoms/xml.c
--- a/monetdb5/modules/atoms/xml.c
+++ b/monetdb5/modules/atoms/xml.c
@@ -376,7 +376,7 @@ XMLparse(xml *x, str *doccont, str *val,
 }
 
 str
-XMLpi(str *ret, str *target, str *value)
+XMLpi(xml *ret, str *target, str *value)
 {
size_t len;
str buf;
diff --git a/monetdb5/modules/mal/mdb.c b/monetdb5/modules/mal/mdb.c
--- a/monetdb5/modules/mal/mdb.c
+++ b/monetdb5/modules/mal/mdb.c
@@ -735,7 +735,7 @@ static str MDBdump(Client cntxt, MalBlkP
 }
 
 static str
-MDBdummy(int *ret)
+MDBdummy(void *ret)
 {
(void) ret;
throw(MAL, "mdb.dummy", OPERATION_FAILED);
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
@@ -2563,10 +2563,8 @@ rel2bin_semijoin(backend *be, sql_rel *r
int idx = 0, equality_only = 1;
 
jexps = get_equi_joins_first(sql, jexps, 
_only);
-   if (!equality_only || list_length(jexps) > 1) {
+   if (!equality_only || list_length(jexps) > 1 || 
exp_has_func((sql_exp*)jexps->h->data))
left = subrel_project(be, left, refs, rel->l);
-   equality_only = 0;
-   }
right = subrel_project(be, right, refs, rel->r);
 
for( en = jexps->h; en; en = en->next ) {
@@ -2575,8 +2573,7 @@ rel2bin_semijoin(backend *be, sql_rel *r
stmt *s = NULL;
 
/* only handle simple joins here */
-   if ((exp_has_func(e) && e->flag != cmp_filter) 
||
-   e->flag == cmp_or || (e->f && e->anti)) 
{
+   if ((exp_has_func(e) && e->flag != cmp_filter) 
|| e->flag == cmp_or || (e->f && e->anti)) {
if (!join && !list_length(lje)) {
stmt *l = bin_first_column(be, 
left);
stmt *r = bin_first_column(be, 
right);
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
@@ -1358,16 +1358,16 @@ can_push_func(sql_exp *e, sql_rel *rel, 
 {
switch(e->type) {
case e_cmp: {
+   int mustl = 0, mustr = 0, mustf = 0;
sql_exp *l = e->l, *r = e->r, *f = e->f;
-   int res = 1, lmust = 0;
-
-   if (e->flag == cmp_or || e->flag == cmp_in || e->flag == 
cmp_notin || e->flag == cmp_filter)
+
+   if (is_project(rel->op) || e->flag == cmp_or || e->flag == 
cmp_in || e->flag == cmp_notin || e->flag == cmp_filter)
return 0;
-   res = can_push_func(l, rel, ) && can_push_func(r, rel, 
) && (!f || can_push_func(f, rel, ));
-   if (res && !lmust)
-   return 1;
-   (*must) |= lmust;
-   return res;
+   return ((l->type == e_column || can_push_func(l, rel, )) 
&& (*must = mustl)) ||
+   (!f && (r->type == e_column || can_push_func(r, 
rel, )) && (*must = mustr)) ||
+   (f &&
+   (r->type == e_column || can_push_func(r, rel, 
)) &&
+   (f->type == e_column || can_push_func(f, rel, )) 
&& (*must = (mustr || mustf)));
}
case e_convert:
return can_push_func(e->l, rel, must);
@@ -1386,8 +1386,7 @@ can_push_func(sql_exp *e, sql_rel *rel, 
return res;
}
case e_column:
-/* aliases cannot be bound on the same level, ie same 
projection */
-   if ((exp_name(e) && !has_label(e)) || (rel && 
!rel_find_exp(rel, e)))
+   if (rel && !rel_find_exp(rel, e))
return 0;
(*must) = 1;
/* fall through */
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
@@ -5719,22 +5719,22 @@ rel_joinquery_(sql_query *query, sql_rel
}
 
lateral = check_is_lateral(tab2);
-   t1 = table_ref(query, NULL, tab1, 0, NULL);
+   t1 = table_ref(query, NULL, tab1, 0, refs);
if (rel && !t1 && sql->session->status != -ERR_AMBIGUOUS) {

MonetDB: nospare - merged

2021-01-21 Thread Niels Nes
Changeset: 066e5323f660 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=066e5323f660
Branch: nospare
Log Message:

merged


diffs (233 lines):

diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -20,16 +20,16 @@
 
 struct versionhead ;// TODO: rename to object_version_chain
 
+#define active (0)
 #define id_based_rollbacked(1)
 #define name_based_rollbacked  (1<<1)
-#define under_destruction  (1<<2)
-#define under_construction (1<<3)
+#define under_destruction  (id_based_rollbacked | 
name_based_rollbacked)
+#define under_resurrection (1<<3)
 
 typedef struct objectversion {
bool deleted;
ulng ts;
-   bte rollbacked;
-   bte life_cycle;
+   bte state;
sql_base *b; // base of underlying sql object
struct objectset* os;
struct objectversion*name_based_older;
@@ -315,7 +315,10 @@ static void os_rollback_name_based_termi
 
 static void
 os_rollback_os_id_based_cascading(objectversion *ov, sqlstore *store) {
-   assert(ov->rollbacked & id_based_rollbacked);
+   // TODO ATOMIC GET
+   bte state = ov->state;
+   // END ATOMIC GET
+   assert(state & id_based_rollbacked);
 
if (ov->id_based_older) {
if (ov->id_based_older->ts < TRANSACTION_ID_BASE) {
@@ -326,9 +329,15 @@ os_rollback_os_id_based_cascading(object
}
else {

os_rollback_name_based_terminal_decendant(ov->name_based_head->ov, store);
+   // TODO ATOMIC GET
+   state = ov->id_based_older->state;
+
+   state |= id_based_rollbacked;
+   //TODO ATOMIC SET
+   ov->id_based_older->state = state;
+   // END ATOMIC SET
 
// id based cascaded rollback along the parents
-   ov->id_based_older->rollbacked |= id_based_rollbacked;
os_rollback_os_id_based_cascading(ov->id_based_older, 
store);
}
}
@@ -340,7 +349,10 @@ os_rollback_os_id_based_cascading(object
 
 static void
 os_rollback_os_name_based_cascading(objectversion *ov, sqlstore *store) {
-   assert(ov->rollbacked & name_based_rollbacked);
+   // TODO ATOMIC GET
+   bte state = ov->state;
+   // END ATOMIC GET
+   assert(state & name_based_rollbacked);
 
if (ov->name_based_older) {
if (ov->name_based_older->ts < TRANSACTION_ID_BASE) {
@@ -351,9 +363,15 @@ os_rollback_os_name_based_cascading(obje
}
else {

os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, store);
+   // TODO ATOMIC GET
+   state = ov->name_based_older->state;
+
+   state |= name_based_rollbacked;
+   //TODO ATOMIC SET
+   ov->name_based_older->state = state;
+   // END ATOMIC SET
 
// name based cascaded rollback along the parents
-   ov->name_based_older->rollbacked |= 
name_based_rollbacked;

os_rollback_os_name_based_cascading(ov->name_based_older, store);
}
}
@@ -365,24 +383,39 @@ os_rollback_os_name_based_cascading(obje
 
 static void
 os_rollback_name_based_terminal_decendant(objectversion *ov, sqlstore *store) {
-   if (ov->rollbacked & name_based_rollbacked) {
+   // TODO ATOMIC GET
+   bte state = ov->state;
+   // END ATOMIC GET
+
+   if (state & name_based_rollbacked) {
return;
}
 
-   ov->rollbacked |= name_based_rollbacked;
+   state |= name_based_rollbacked;
+
+   //TODO ATOMIC SET
+   ov->state = state;
+   // END ATOMIC SET
 
os_rollback_id_based_terminal_decendant(ov->id_based_head->ov, store);
os_rollback_os_name_based_cascading(ov, store);
-
 }
 
 static void
 os_rollback_id_based_terminal_decendant(objectversion *ov, sqlstore *store) {
-   if (ov->rollbacked & id_based_rollbacked) {
+   // TODO ATOMIC GET
+   bte state = ov->state;
+   // END ATOMIC GET
+
+   if (state & id_based_rollbacked) {
return;
}
 
-   ov->rollbacked |= id_based_rollbacked;
+   state |= id_based_rollbacked;
+
+   //TODO ATOMIC SET
+   ov->state = state;
+   // END ATOMIC SET
 
os_rollback_name_based_terminal_decendant(ov->name_based_head->ov, 
store);
os_rollback_os_id_based_cascading(ov, store);
@@ -402,8 +435,8 @@ static void
 put_under_destruction(sqlstore* store, objectversion *ov, ulng oldest)
 {
//TODO ATOMIC CAS
-   if (ov->life_cycle == 0) {
-   ov->life_cycle = under_destruction;
+   if 

MonetDB: nospare - merged

2021-01-21 Thread Niels Nes
Changeset: 5d78ec199c33 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5d78ec199c33
Branch: nospare
Log Message:

merged


diffs (truncated from 516 to 300 lines):

diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -20,14 +20,18 @@
 
 struct object_node;// TODO: rename to object_version_chain
 
-#define id_based_rollbacked 1
-#define name_based_rollbacked (1<<1)
+#define id_based_rollbacked(1)
+#define name_based_rollbacked  (1<<1)
+#define under_destruction  (1<<2)
+#define under_construction (1<<3)
 
 typedef struct objectversion {
bool deleted;
ulng ts;
bte rollbacked;
+   bte life_cycle;
sql_base *obj;
+   struct objectset* os;
struct objectversion*name_based_older;
struct objectversion*name_based_newer; // TODO: must become atomic 
pointer
struct object_node  *name_based_chain;
@@ -41,7 +45,6 @@ typedef struct object_node {
 struct object_node* prev;
 struct object_node* next;
 objectversion* data;
-   struct objectset* os;
 } object_node;
 
 typedef struct objectset {
@@ -229,7 +232,6 @@ os_append_node_name(objectset *os, objec
} else {
os->name_based_h = n;
}
-   n->os = os;
n->prev = os->name_based_t; // aka the double linked list.
os->name_based_t = n;
if (n->data) {
@@ -268,7 +270,6 @@ os_append_node_id(objectset *os, object_
} else {
os->id_based_h = n;
}
-   n->os = os;
n->prev = os->id_based_t; // aka the double linked list.
os->id_based_t = n;
if (n->data) {
@@ -301,42 +302,12 @@ os_append_id(objectset *os, objectversio
 static object_node* find_name(objectset *os, const char *name);
 
 static void
-objectversion_destroy(sqlstore *store, objectversion *ov, ulng commit_ts, ulng 
oldest)
+objectversion_destroy(sqlstore *store, objectset* os, objectversion *ov)
 {
-   // TODO: clean this up once the add and del functions are working
-   // TODO: handle name_based_cnt s and id_based_cnt s
-   objectversion *name_based_older = ov->name_based_older;
-   objectversion *name_based_newer = ov->name_based_newer;
-
-   if (name_based_older && commit_ts) {
-   objectversion_destroy(store, name_based_older, commit_ts, 
oldest);
-   name_based_older = NULL;
-   } else if (name_based_older) {
-   name_based_older->name_based_newer = name_based_newer;
-   }
-   ov->name_based_older = NULL;
+   if (os->destroy)
+   os->destroy(store, ov->obj);
 
-   if (name_based_newer && commit_ts)
-   name_based_newer->name_based_older = NULL;
-   else if (name_based_newer && name_based_older)
-   name_based_newer->name_based_older = name_based_older;
-
-   objectset* os = ov->name_based_chain->os;
-   if (!name_based_newer) {
-   object_node *on = NULL;
-   if (os->unique)
-   on = find_name(os, ov->obj->name);
-   else
-   on = find_id(os, ov->obj->id);
-   assert(on->data == ov);
-   if (on)
-   os_remove_name_based_chain(os, store, on);
-   if (name_based_older)
-   os_append_name(os, name_based_older);
-   }
-   if (ov && os && os->destroy)
-   os->destroy(store, ov->obj);
-   /* free ov */
+   _DELETE(ov);
 }
 
 static void os_rollback_id_based_terminal_decendant(objectversion *ov, 
sqlstore *store);
@@ -363,7 +334,7 @@ os_rollback_os_id_based_cascading(object
}
else {
// this is a terminal node. i.e. this objectversion does not 
have id based committed history
-   os_remove_id_based_chain(ov->id_based_chain->os, store, 
ov->id_based_chain);
+   os_remove_id_based_chain(ov->os, store, ov->id_based_chain);
}
 }
 
@@ -388,7 +359,7 @@ os_rollback_os_name_based_cascading(obje
}
else {
// this is a terminal node. i.e. this objectversion does not 
have name based committed history
-   os_remove_name_based_chain(ov->name_based_chain->os, store, 
ov->name_based_chain);
+   os_remove_name_based_chain(ov->os, store, ov->name_based_chain);
}
 }
 
@@ -427,46 +398,99 @@ os_rollback(objectversion *ov, sqlstore 
return LOG_OK;
 }
 
+static void
+put_under_destruction(sqlstore* store, objectversion *ov, ulng oldest)
+{
+   //TODO ATOMIC CAS
+   if (ov->life_cycle == 0) {
+   ov->life_cycle = under_destruction;
+
+   if (!ov->name_based_newer) {
+   os_remove_name_based_chain(ov->os, store, 
ov->name_based_chain);
+   }
+   else {
+   

MonetDB: nospare - merged with default

2021-01-21 Thread Niels Nes
Changeset: 3c163505cee4 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3c163505cee4
Branch: nospare
Log Message:

merged with default


diffs (107 lines):

diff --git a/testing/melcheck.py b/testing/melcheck.py
--- a/testing/melcheck.py
+++ b/testing/melcheck.py
@@ -12,21 +12,69 @@ except ImportError:
 from MonetDBtesting import exportutils
 
 # MEL pattern
-argreg = 
r'\s*,\s*(?:bat)?(?:var)?arg(?:any)?\s*\(\s*(?P"[^"]*")\s*,\s*(?P\w*)\s*\)'
+argreg = 
r'\s*,\s*(?Pbat)?(?Pvar)?arg(?Pany)?\s*\(\s*(?P"[^"]*")\s*,\s*(?P\w*)\s*\)'
 patreg = 
r'^\s*(?Ppattern|command)\s*\(\s*"(?P[^"]*)"\s*,\s*"(?P[^"]*)"\s*,\s*(?P\w+)\s*,[^,]*,\s*"[^\"]*(?:\\.[^\"]*)*"\s*,\s*args\s*\(\s*(?P\d+)\s*,\s*(?P\d+)(?P(?:'+argreg+')*)\s*\)\s*\)'
 
 argre = re.compile(argreg)
 patre = re.compile(patreg, re.MULTILINE)
 
-fcnreg = 
r'(?:static\s+)?(?:str|char\s*\*)\s+(?P\w+)\s*\(\s*(?:(?PClient\s+\w+\s*,\s*MalBlkPtr\s+\w+\s*,\s*MalStkPtr\s+\w+\s*,\s*InstrPtr\s+\w+)|(?P(?:\w+\s*\*+|ptr\s)\s*\w+(?:\s*,\s*(?:const\s+)?(?:\w+\s*\*(?:\s*(?:const\s*)?\*)*|ptr\s)\s*\w+)*))\s*\)\s*{'
+fcnargreg = 
r'\s*,\s*(?:const\s+)?(?:(?P\w+)\s*\*(?:\s*(?:const\s*)?\*)*|ptr\s)\s*(?P\w+)'
+fcnreg = 
r'(?:static\s+)?(?:str|char\s*\*)\s+(?P\w+)\s*\(\s*(?:(?PClient\s+\w+\s*,\s*MalBlkPtr\s+\w+\s*,\s*MalStkPtr\s+\w+\s*,\s*InstrPtr\s+\w+)|(?P(?:\w+\s*\*+|ptr\s)\s*\w+(?:'+
 fcnargreg + r')*))\s*\)\s*{'
 
 fcnre = re.compile(fcnreg)
+fcnargre = re.compile(fcnargreg)
 
 gpats = {}
 gcmds = {}
 
 mel = []
 
+mappings = {
+'streams': 'Stream',
+'bstream': 'Bstream',
+}
+
+def checkcommand(imp, mod, fcn, decl, retc, argc, args):
+if argc < retc:
+print('bad argc < retc for command {}.{} with implementation 
{}'.format(mod, fcn, imp))
+return
+decl = ',' + decl   # makes processing easier
+pos = 0
+cpos = 0
+if retc == 0:
+retc = 1
+argc += 1
+args = ',arg("",void)' + args
+for i in range(argc):
+res = argre.match(args, pos)
+if res is None:
+print('not enough arguments in command {}.{} with implementation 
{}'.format(mod, fcn, imp))
+return
+if res.group('var'):
+print('cannot have variable number of arguments in command {}.{} 
with implementation {}'.format(mod, fcn, imp))
+return
+if res.group('bat'):
+cmaltype = 'bat'
+elif res.group('any'):
+cmaltype = 'void'
+else:
+cmaltype = res.group('argval')
+cmaltype = mappings.get(cmaltype, cmaltype)
+cres = fcnargre.match(decl, cpos)
+if cres is None:
+print('not enough arguments in implementation {} for command 
{}.{}'.format(imp, mod, fcn))
+return
+ctype = cres.group('type')
+if not ctype:
+ctype = 'void'  # declared as "ptr val", so type is void *
+if i < retc and 'const' in cres.group(0):
+print('const return pointer in implementation {} for command {}.{} 
(arg {})'.format(imp, mod, fcn, i))
+if ctype != cmaltype:
+if cmaltype != 'str' or ctype != 'char' or 
cres.group(0).count('*') != 2:
+print('type mismatch for arg {} in implementation {} for 
command {}.{}'.format(i, imp, mod, fcn))
+pos = res.end(0)
+cpos = cres.end(0)
+
 def process1(f):
 data = exportutils.preprocess(f)
 pats = {}
@@ -51,17 +99,19 @@ def process1(f):
 if imp in cmds or imp in gcmds:
 print('command implementation {} for pattern 
{}.{}'.format(imp, res.group('mod'), res.group('fcn')))
 else:
-mel.append(('pattern', imp, res.group('mod'), 
res.group('fcn')))
+mel.append(('pattern', imp, res.group('mod'), 
res.group('fcn'), res.group('retc'), res.group('argc'), res.group('args')))
 else:
 if imp not in cmds and imp not in gcmds:
 if imp in pats or imp in gpats:
 print('pattern implementation {} for command 
{}.{}'.format(imp, res.group('mod'), res.group('fcn')))
 else:
-mel.append(('command ', imp, res.group('mod'), 
res.group('fcn')))
+mel.append(('command', imp, res.group('mod'), 
res.group('fcn'), res.group('retc'), res.group('argc'), res.group('args')))
+else:
+checkcommand(imp, res.group('mod'), res.group('fcn'), 
cmds.get(imp, gcmds.get(imp)), int(res.group('retc')), int(res.group('argc')), 
res.group('args'))
 res = patre.search(data, pos=res.end(0))
 
 def process2():
-for (cmdpat, imp, mod, fcn) in mel:
+for (cmdpat, imp, mod, fcn, retc, argc, args) in mel:
 if cmdpat == 'pattern':
 if imp not in gpats:
 if imp in gcmds:
@@ -74,6 +124,8 @@ def process2():
 print('pattern implementation {} for command 
{}.{}'.format(imp, res.group('mod'), 

MonetDB: nospare - merged

2021-01-20 Thread Niels Nes
Changeset: abec2e224266 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=abec2e224266
Modified Files:
sql/server/sql_semantic.c
sql/storage/objectset.c
Branch: nospare
Log Message:

merged


diffs (truncated from 747 to 300 lines):

diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c
--- a/sql/server/sql_semantic.c
+++ b/sql/server/sql_semantic.c
@@ -348,9 +348,12 @@ os_find_func_internal(mvc *sql, struct o
os_iterator(, ff, sql->session->tr, fname);
for (sql_base *b = oi_next(); b; b = oi_next()) {
sql_func *f = (sql_func*)b;
-   if (prev && prev->func != f)
+   if (prev && prev->func != f) {
continue;
-   prev = NULL;
+   } else if (prev) {
+   prev = NULL;
+   continue;
+   }
 
if (f->type != type && f->type != filt)
continue;
@@ -444,6 +447,10 @@ os_bind_member_internal(mvc *sql, struct
sql_func *f = (sql_func*)b;
if (prev && prev->func != f)
continue;
+   else if (prev) {
+   prev = NULL;
+   continue;
+   }
 
if (!f->res && !IS_FILT(f))
continue;
diff --git a/sql/storage/objectset.c b/sql/storage/objectset.c
--- a/sql/storage/objectset.c
+++ b/sql/storage/objectset.c
@@ -549,6 +549,9 @@ os_name_key(object_node *n)
return hash_key(n->data->obj->name);
 }
 
+// disabled because we need functions a in order (need some insert - order 
preserving hash) ..
+//#define USE_HASH
+#ifdef USE_HASH
 static sql_hash*
 os_hash_create(objectset *os)
 {
@@ -580,6 +583,7 @@ find_hash_entry(sql_hash *map, const cha
 
return he;
 }
+#endif
 
 static object_node *
 find_name(objectset *os, const char *name)
@@ -924,11 +928,13 @@ os_iterator(struct os_iter *oi, struct o
.tr = tr,
.name = name,
};
+#ifdef USE_HASH
if (os->name_based_h && name) {
if (!os->name_map)
os->name_map = os_hash_create(os);
oi->e = find_hash_entry(os->name_map, name);
} else
+#endif
oi->n = os->name_based_h;
 }
 
@@ -937,6 +943,7 @@ oi_next(struct os_iter *oi)
 {
sql_base *b = NULL;
 
+#ifdef USE_HASH
if (oi->name) {
sql_hash_e *e = oi->e;
 
@@ -953,7 +960,25 @@ oi_next(struct os_iter *oi)
} else {
e = e->chain;
}
-   }
+   }
+#else
+   if (oi->name) {
+   object_node *n = oi->n;
+
+   while (n && !b) {
+
+   if (n->data->obj->name && strcmp(n->data->obj->name, 
oi->name) == 0) {
+   objectversion *ov = n->data;
+
+   n = oi->n = n->next;
+   ov = get_valid_object_name(oi->tr, ov);
+   if (ov && !ov->deleted)
+   b = ov->obj;
+   } else {
+   n = oi->n = n->next;
+   }
+   }
+#endif
} else {
object_node *n = oi->n;
 
diff --git a/testing/Mz.py.in b/testing/Mz.py.in
--- a/testing/Mz.py.in
+++ b/testing/Mz.py.in
@@ -2841,7 +2841,7 @@ def main(argv) :
 prgreen('OK')
 print()
 print('failed={}, skipped={}'.format(failed, skipped))
-print('Ran {} test in {:7.3f}'.format(test_count - skipped, t_))
+print('Ran {} test in {:7.3f}s'.format(test_count - skipped, t_))
 if verbose:
 for TSTDIR, TST in FAILED_TESTS:
 prred('ERROR\t')
diff --git a/testing/exportutils.py b/testing/exportutils.py
--- a/testing/exportutils.py
+++ b/testing/exportutils.py
@@ -5,119 +5,157 @@
 # Copyright 1997 - July 2008 CWI, August 2008 - 2021 MonetDB B.V.
 
 import re
-
-# a function-like #define that we expand to also find exports hidden
-# in preprocessor macros
-defre = re.compile(r'^[ \t]*#[ \t]*define[ \t]+'# #define
-   r'(?P[a-zA-Z_][a-zA-Z0-9_]*)'  # name being 
defined
-   r'\((?P[a-zA-Z0-9_, \t]*)\)[ \t]*' # arguments
-   r'(?P.*)$', # macro replacement
-   re.MULTILINE)
-# line starting with a "#"
-cldef = re.compile(r'^[ \t]*#', re.MULTILINE)
+import os
 
-# white space
-spcre = re.compile(r'\s+')
+# macro definition
+macrore = re.compile(r'\s*#\s*define\s+'# #define
+ r'(?P\w+)'   

MonetDB: nospare - merged with default

2021-01-20 Thread Niels Nes
Changeset: 00de3e819972 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=00de3e819972
Modified Files:
sql/backends/monet5/sql.c
sql/server/rel_rel.c
sql/server/sql_partition.c
Branch: nospare
Log Message:

merged with default


diffs (truncated from 1813 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -9233,7 +9233,7 @@ stdout of test 'MAL-signatures` in direc
 [ "remote","batbincopy",   "pattern remote.batbincopy(X_1:bat[:any]):void 
",   "RMTbincopyto;",""  ]
 [ "remote","batload",  "pattern remote.batload(X_1:any_1, 
X_2:int):bat[:any_1] ",  "RMTbatload;",  ""  ]
 [ "remote","bintype",  "pattern remote.bintype():void ",   
"RMTbintype;",  ""  ]
-[ "remote","connect",  "command remote.connect(X_1:str, X_2:str, 
X_3:str, X_4:str):str ",  "RMTconnect;",  ""  ]
+[ "remote","connect",  "pattern remote.connect(X_1:str, X_2:str, 
X_3:str, X_4:str):str ",  "RMTconnect;",  ""  ]
 [ "remote","connect",  "command remote.connect(X_1:str, X_2:str, 
X_3:str, X_4:str, X_5:bit):str ", "RMTconnectScen;",  ""  ]
 [ "remote","connect",  "pattern remote.connect(X_1:str, X_2:str):str 
","RMTconnectTable;", ""  ]
 [ "remote","disconnect",   "command remote.disconnect(X_1:str):void ", 
"RMTdisconnect;",   ""  ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -12534,7 +12534,7 @@ stdout of test 'MAL-signatures` in direc
 [ "remote","batbincopy",   "pattern remote.batbincopy(X_1:bat[:any]):void 
",   "RMTbincopyto;",""  ]
 [ "remote","batload",  "pattern remote.batload(X_1:any_1, 
X_2:int):bat[:any_1] ",  "RMTbatload;",  ""  ]
 [ "remote","bintype",  "pattern remote.bintype():void ",   
"RMTbintype;",  ""  ]
-[ "remote","connect",  "command remote.connect(X_1:str, X_2:str, 
X_3:str, X_4:str):str ",  "RMTconnect;",  ""  ]
+[ "remote","connect",  "pattern remote.connect(X_1:str, X_2:str, 
X_3:str, X_4:str):str ",  "RMTconnect;",  ""  ]
 [ "remote","connect",  "command remote.connect(X_1:str, X_2:str, 
X_3:str, X_4:str, X_5:bit):str ", "RMTconnectScen;",  ""  ]
 [ "remote","connect",  "pattern remote.connect(X_1:str, X_2:str):str 
","RMTconnectTable;", ""  ]
 [ "remote","disconnect",   "command remote.disconnect(X_1:str):void ", 
"RMTdisconnect;",   ""  ]
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
@@ -337,8 +337,9 @@ create_table_or_view(mvc *sql, char* sna
sql_column *c = n->data;
 
if (c->def) {
+   /* TODO please don't place an auto incremented sequence 
in the default value */
+   const char *next_value_for = "next value for 
\"sys\".\"seq_";
sql_rel *r = NULL;
-   list *id_l;
 
sql->sa = sql->ta;
r = rel_parse(sql, s, sa_message(sql->ta, "select %s;", 
c->def), m_deps);
@@ -353,8 +354,12 @@ create_table_or_view(mvc *sql, char* sna
else
throw(SQL, "sql.catalog", 
SQLSTATE(42000) "%s", sql->errstr);
}
-   id_l = rel_dependencies(sql, r);
-   mvc_create_dependencies(sql, id_l, nt->base.id, 
FUNC_DEPENDENCY);
+   /* For a self incremented column, it's sequence will 
get a BEDROPPED_DEPENDENCY,
+   so no additional dependencies are needed */
+   if (strncmp(c->def, next_value_for, 
strlen(next_value_for)) != 0) {
+   list *id_l = rel_dependencies(sql, r);
+   mvc_create_dependencies(sql, id_l, nt->base.id, 
FUNC_DEPENDENCY);
+   }
rel_destroy(r);
sa_reset(sql->sa);
}
diff --git a/sql/server/rel_exp.c b/sql/server/rel_exp.c
--- a/sql/server/rel_exp.c
+++ b/sql/server/rel_exp.c
@@ -2963,6 +2963,7 @@ exp_check_type(mvc *sql, sql_subtype *t,
}
}
if (err) {
+   const char *name = (exp->type == e_column && !has_label(exp)) ? 
exp_name(exp) : "%";
sql_exp *res = sql_error( sql, 03, SQLSTATE(42000) "types 
%s(%u,%u) and %s(%u,%u) are not equal%s%s%s",
fromtype->type->sqlname,
fromtype->digits,
@@ 

MonetDB: nospare - merged with default

2021-01-20 Thread Niels Nes
Changeset: df09457a2551 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=df09457a2551
Modified Files:
sql/backends/monet5/sql_statement.c
testing/Mtest.py.in
Branch: nospare
Log Message:

merged with default


diffs (truncated from 684 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -611,11 +611,7 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "fetch","command algebra.fetch(X_1:bat[:any_1], 
X_2:oid):any_1 ",   "ALGfetchoid;", ""  ]
 [ "algebra",   "find", "command algebra.find(X_1:bat[:any_1], X_2:any_1):oid 
","ALGfind;", ""  ]
 [ "algebra",   "firstn",   "pattern algebra.firstn(X_1:bat[:any], 
X_2:bat[:oid], X_3:bat[:oid], X_4:lng, X_5:bit, X_6:bit, X_7:bit):bat[:oid] ",  
 "ALGfirstn;",   ""  ]
-[ "algebra",   "firstn",   "pattern algebra.firstn(X_1:bat[:any], 
X_2:bat[:oid], X_3:lng, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ",  "ALGfirstn;",  
 ""  ]
-[ "algebra",   "firstn",   "pattern algebra.firstn(X_1:bat[:any], X_2:lng, 
X_3:bit, X_4:bit, X_5:bit):bat[:oid] ", "ALGfirstn;",   ""  ]
 [ "algebra",   "firstn",   "pattern algebra.firstn(X_2:bat[:any], 
X_3:bat[:oid], X_4:bat[:oid], X_5:lng, X_6:bit, X_7:bit, X_8:bit) 
(X_0:bat[:oid], X_1:bat[:oid]) ",  "ALGfirstn;",   ""  ]
-[ "algebra",   "firstn",   "pattern algebra.firstn(X_2:bat[:any], 
X_3:bat[:oid], X_4:lng, X_5:bit, X_6:bit, X_7:bit) (X_0:bat[:oid], 
X_1:bat[:oid]) ", "ALGfirstn;",   ""  ]
-[ "algebra",   "firstn",   "pattern algebra.firstn(X_2:bat[:any], X_3:lng, 
X_4:bit, X_5:bit, X_6:bit) (X_0:bat[:oid], X_1:bat[:oid]) ","ALGfirstn;",   
""  ]
 [ "algebra",   "groupby",  "command algebra.groupby(X_1:bat[:oid], 
X_2:bat[:lng]):bat[:oid] ", "ALGgroupby;",  ""  ]
 [ "algebra",   "ilike","command algebra.ilike(X_1:str, X_2:str):bit ", 
"PCREilike2;",  ""  ]
 [ "algebra",   "ilike","command algebra.ilike(X_1:str, X_2:str, 
X_3:str):bit ","PCREilike3;",  ""  ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -724,11 +724,7 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "fetch","command algebra.fetch(X_1:bat[:any_1], 
X_2:oid):any_1 ",   "ALGfetchoid;", ""  ]
 [ "algebra",   "find", "command algebra.find(X_1:bat[:any_1], X_2:any_1):oid 
","ALGfind;", ""  ]
 [ "algebra",   "firstn",   "pattern algebra.firstn(X_1:bat[:any], 
X_2:bat[:oid], X_3:bat[:oid], X_4:lng, X_5:bit, X_6:bit, X_7:bit):bat[:oid] ",  
 "ALGfirstn;",   ""  ]
-[ "algebra",   "firstn",   "pattern algebra.firstn(X_1:bat[:any], 
X_2:bat[:oid], X_3:lng, X_4:bit, X_5:bit, X_6:bit):bat[:oid] ",  "ALGfirstn;",  
 ""  ]
-[ "algebra",   "firstn",   "pattern algebra.firstn(X_1:bat[:any], X_2:lng, 
X_3:bit, X_4:bit, X_5:bit):bat[:oid] ", "ALGfirstn;",   ""  ]
 [ "algebra",   "firstn",   "pattern algebra.firstn(X_2:bat[:any], 
X_3:bat[:oid], X_4:bat[:oid], X_5:lng, X_6:bit, X_7:bit, X_8:bit) 
(X_0:bat[:oid], X_1:bat[:oid]) ",  "ALGfirstn;",   ""  ]
-[ "algebra",   "firstn",   "pattern algebra.firstn(X_2:bat[:any], 
X_3:bat[:oid], X_4:lng, X_5:bit, X_6:bit, X_7:bit) (X_0:bat[:oid], 
X_1:bat[:oid]) ", "ALGfirstn;",   ""  ]
-[ "algebra",   "firstn",   "pattern algebra.firstn(X_2:bat[:any], X_3:lng, 
X_4:bit, X_5:bit, X_6:bit) (X_0:bat[:oid], X_1:bat[:oid]) ","ALGfirstn;",   
""  ]
 [ "algebra",   "groupby",  "command algebra.groupby(X_1:bat[:oid], 
X_2:bat[:lng]):bat[:oid] ", "ALGgroupby;",  ""  ]
 [ "algebra",   "ilike","command algebra.ilike(X_1:str, X_2:str):bit ", 
"PCREilike2;",  ""  ]
 [ "algebra",   "ilike","command algebra.ilike(X_1:str, X_2:str, 
X_3:str):bit ","PCREilike3;",  ""  ]
diff --git a/monetdb5/modules/kernel/algebra.c 
b/monetdb5/modules/kernel/algebra.c
--- a/monetdb5/modules/kernel/algebra.c
+++ b/monetdb5/modules/kernel/algebra.c
@@ -679,7 +679,7 @@ ALGfirstn(Client cntxt, MalBlkPtr mb, Ma
assert(pci->retc == 1 || pci->retc == 2);
assert(pci->argc - pci->retc >= 5 && pci->argc - pci->retc <= 7);
 
-   n = * getArgReference_lng(stk, pci, pci->argc - 4);
+   n = *getArgReference_lng(stk, pci, pci->argc - 4);
if (n < 0 || (lng) n >= (lng) BUN_MAX)
throw(MAL, "algebra.firstn", ILLEGAL_ARGUMENT);
ret1 = getArgReference_bat(stk, pci, 0);
@@ -696,16 +696,16 @@ ALGfirstn(Client cntxt, MalBlkPtr mb, Ma
}
if (pci->argc - pci->retc > 6) {
gid = *getArgReference_bat(stk, pci, pci->retc + 2);
-   if ((g = 

MonetDB: nospare - merged

2021-01-19 Thread Niels Nes
Changeset: b51a633cc2b0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b51a633cc2b0
Modified Files:
sql/backends/monet5/sql_statement.c
sql/server/rel_optimizer.c
testing/Mtest.py.in
Branch: nospare
Log Message:

merged


diffs (truncated from 1642 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -676,8 +676,7 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "thetajoin","command algebra.thetajoin(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bat[:oid], X_4:bat[:oid], X_5:int, X_6:bit, 
X_7:lng):bat[:oid] ",  "ALGthetajoin1;",   ""  ]
 [ "algebra",   "thetajoin","command algebra.thetajoin(X_2:bat[:any_1], 
X_3:bat[:any_1], X_4:bat[:oid], X_5:bat[:oid], X_6:int, X_7:bit, X_8:lng) 
(X_0:bat[:oid], X_1:bat[:oid]) ", "ALGthetajoin;",""  ]
 [ "algebra",   "thetaselect",  "command algebra.thetaselect(X_1:bat[:any_1], 
X_2:bat[:oid], X_3:any_1, X_4:str):bat[:oid] ",   "ALGthetaselect2;", ""
  ]
-[ "algebra",   "unique",   "command 
algebra.unique(X_1:bat[:any_1]):bat[:oid] ",   "ALGunique1;",  ""  ]
-[ "algebra",   "unique",   "command algebra.unique(X_1:bat[:any_1], 
X_2:bat[:oid]):bat[:oid] ","ALGunique2;",  ""  ]
+[ "algebra",   "unique",   "command algebra.unique(X_1:bat[:any_1], 
X_2:bat[:oid]):bat[:oid] ","ALGunique;",   ""  ]
 [ "bat",   "append",   "command bat.append(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bat[:oid], X_4:bit):bat[:any_1] ",
"BKCappend_cand_force_wrap;",   ""  ]
 [ "bat",   "append",   "command bat.append(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bat[:oid]):bat[:any_1] ", "BKCappend_cand_wrap;", ""   
   ]
 [ "bat",   "append",   "command bat.append(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bit):bat[:any_1] ",   "BKCappend_force_wrap;",""   
   ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -789,8 +789,7 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "thetajoin","command algebra.thetajoin(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bat[:oid], X_4:bat[:oid], X_5:int, X_6:bit, 
X_7:lng):bat[:oid] ",  "ALGthetajoin1;",   ""  ]
 [ "algebra",   "thetajoin","command algebra.thetajoin(X_2:bat[:any_1], 
X_3:bat[:any_1], X_4:bat[:oid], X_5:bat[:oid], X_6:int, X_7:bit, X_8:lng) 
(X_0:bat[:oid], X_1:bat[:oid]) ", "ALGthetajoin;",""  ]
 [ "algebra",   "thetaselect",  "command algebra.thetaselect(X_1:bat[:any_1], 
X_2:bat[:oid], X_3:any_1, X_4:str):bat[:oid] ",   "ALGthetaselect2;", ""
  ]
-[ "algebra",   "unique",   "command 
algebra.unique(X_1:bat[:any_1]):bat[:oid] ",   "ALGunique1;",  ""  ]
-[ "algebra",   "unique",   "command algebra.unique(X_1:bat[:any_1], 
X_2:bat[:oid]):bat[:oid] ","ALGunique2;",  ""  ]
+[ "algebra",   "unique",   "command algebra.unique(X_1:bat[:any_1], 
X_2:bat[:oid]):bat[:oid] ","ALGunique;",   ""  ]
 [ "bat",   "append",   "command bat.append(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bat[:oid], X_4:bit):bat[:any_1] ",
"BKCappend_cand_force_wrap;",   ""  ]
 [ "bat",   "append",   "command bat.append(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bat[:oid]):bat[:any_1] ", "BKCappend_cand_wrap;", ""   
   ]
 [ "bat",   "append",   "command bat.append(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bit):bat[:any_1] ",   "BKCappend_force_wrap;",""   
   ]
diff --git a/clients/examples/C/bincopydata.c b/clients/examples/C/bincopydata.c
--- a/clients/examples/C/bincopydata.c
+++ b/clients/examples/C/bincopydata.c
@@ -158,6 +158,7 @@ gen_large_strings(FILE *f, bool byteswap
fwrite(buf, n, 1, f);
fputc(0, f);
}
+   free(buf);
(void)byteswap;
 }
 
@@ -173,7 +174,7 @@ gen_broken_strings(FILE *f, bool byteswa
if (i == 123456)
fwrite(latin1, sizeof(latin1), 1, f);
else
-   fwrite(latin1, sizeof(utf8), 1, f);
+   fwrite(utf8, sizeof(utf8), 1, f);
}
 }
 
diff --git 
a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows
 
b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows
--- 
a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows
+++ 
b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows
@@ -10,21 +10,23 @@
 % .%1 # table_name
 % def # name
 % clob # type
-% 580 # length
+% 626 # length
 [ 

MonetDB: nospare - merged with default

2021-01-18 Thread Niels Nes
Changeset: 5456b1cd264f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=5456b1cd264f
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
Branch: nospare
Log Message:

merged with default


diffs (truncated from 1945 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -675,7 +675,6 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "subslice", "command algebra.subslice(X_1:bat[:any_1], 
X_2:lng, X_3:lng):bat[:oid] ",   "ALGsubslice_lng;", ""  ]
 [ "algebra",   "thetajoin","command algebra.thetajoin(X_1:bat[:any_1], 
X_2:bat[:any_1], X_3:bat[:oid], X_4:bat[:oid], X_5:int, X_6:bit, 
X_7:lng):bat[:oid] ",  "ALGthetajoin1;",   ""  ]
 [ "algebra",   "thetajoin","command algebra.thetajoin(X_2:bat[:any_1], 
X_3:bat[:any_1], X_4:bat[:oid], X_5:bat[:oid], X_6:int, X_7:bit, X_8:lng) 
(X_0:bat[:oid], X_1:bat[:oid]) ", "ALGthetajoin;",""  ]
-[ "algebra",   "thetaselect",  "command algebra.thetaselect(X_1:bat[:any_1], 
X_2:any_1, X_3:str):bat[:oid] ",  "ALGthetaselect1;", ""  ]
 [ "algebra",   "thetaselect",  "command algebra.thetaselect(X_1:bat[:any_1], 
X_2:bat[:oid], X_3:any_1, X_4:str):bat[:oid] ",   "ALGthetaselect2;", ""
  ]
 [ "algebra",   "unique",   "command 
algebra.unique(X_1:bat[:any_1]):bat[:oid] ",   "ALGunique1;",  ""  ]
 [ "algebra",   "unique",   "command algebra.unique(X_1:bat[:any_1], 
X_2:bat[:oid]):bat[:oid] ","ALGunique2;",  ""  ]
@@ -8544,19 +8543,12 @@ stdout of test 'MAL-signatures` in direc
 [ "generator", "series",   "pattern generator.series(X_1:sht, X_2:sht, 
X_3:sht):bat[:sht] ",   "VLTgenerator_table;",  ""  ]
 [ "generator", "series",   "pattern generator.series(X_1:timestamp, 
X_2:timestamp, X_3:lng):bat[:timestamp] ", "VLTgenerator_table;",  ""  ]
 [ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:bte], 
X_2:bat[:oid], X_3:bte, X_4:str):bat[:oid] ", 
"VLTgenerator_thetasubselect;", ""  ]
-[ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:bte], 
X_2:bte, X_3:str):bat[:oid] ","VLTgenerator_thetasubselect;", ""  ]
 [ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:dbl], 
X_2:bat[:oid], X_3:dbl, X_4:str):bat[:oid] ", 
"VLTgenerator_thetasubselect;", ""  ]
-[ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:dbl], 
X_2:dbl, X_3:str):bat[:oid] ","VLTgenerator_thetasubselect;", ""  ]
 [ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:flt], 
X_2:bat[:oid], X_3:flt, X_4:str):bat[:oid] ", 
"VLTgenerator_thetasubselect;", ""  ]
-[ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:flt], 
X_2:flt, X_3:str):bat[:oid] ","VLTgenerator_thetasubselect;", ""  ]
 [ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:int], 
X_2:bat[:oid], X_3:int, X_4:str):bat[:oid] ", 
"VLTgenerator_thetasubselect;", ""  ]
-[ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:int], 
X_2:int, X_3:str):bat[:oid] ","VLTgenerator_thetasubselect;", ""  ]
 [ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:lng], 
X_2:bat[:oid], X_3:lng, X_4:str):bat[:oid] ", 
"VLTgenerator_thetasubselect;", ""  ]
-[ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:lng], 
X_2:lng, X_3:str):bat[:oid] ","VLTgenerator_thetasubselect;", ""  ]
 [ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:sht], 
X_2:bat[:oid], X_3:sht, X_4:str):bat[:oid] ", 
"VLTgenerator_thetasubselect;", ""  ]
-[ "generator", "thetaselect",  "pattern generator.thetaselect(X_1:bat[:sht], 
X_2:sht, X_3:str):bat[:oid] ","VLTgenerator_thetasubselect;", ""  ]
 [ "generator", "thetaselect",  "pattern 
generator.thetaselect(X_1:bat[:timestamp], X_2:bat[:oid], X_3:timestamp, 
X_4:str):bat[:oid] ", "VLTgenerator_thetasubselect;", ""  ]
-[ "generator", "thetaselect",  "pattern 
generator.thetaselect(X_1:bat[:timestamp], X_2:timestamp, X_3:str):bat[:oid] ", 
   "VLTgenerator_thetasubselect;", ""  ]
 [ "geom",  "Area", "command geom.Area(X_1:wkb):dbl ",  "wkbArea;", 
""  ]
 [ "geom",  "AsBinary", "command geom.AsBinary(X_1:wkb):str ",  
"wkbAsBinary;", ""  ]
 [ "geom",  "AsEWKT",   "function geom.AsEWKT(w:wkb):str;", "", 
""  ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -788,7 +788,6 @@ stdout of test 'MAL-signatures` in direc
 [ "algebra",   "subslice", "command algebra.subslice(X_1:bat[:any_1], 
X_2:lng, 

MonetDB: nospare - merged with default

2021-01-18 Thread Niels Nes
Changeset: d86ec51033cc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d86ec51033cc
Modified Files:
sql/backends/monet5/sql_scenario.c
sql/server/rel_optimizer.c
sql/server/rel_updates.c
Branch: nospare
Log Message:

merged with default


diffs (truncated from 785 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -793,3 +793,6 @@ ac8254a47e87d0be9df2a623e2c2fcf67c0f982d
 ac8254a47e87d0be9df2a623e2c2fcf67c0f982d Oct2020_SP1_release
 929f5e280bc1532a2bfaab127ca7915dc3b69a33 Oct2020_9
 929f5e280bc1532a2bfaab127ca7915dc3b69a33 Oct2020_SP2_release
+742b7847cfdcea39a6c19ab29eb35471d46bb2bb Oct2020_11
+929f5e280bc1532a2bfaab127ca7915dc3b69a33 Oct2020_SP2_release
+742b7847cfdcea39a6c19ab29eb35471d46bb2bb Oct2020_SP2_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -823,6 +823,10 @@ else
 fi
 
 %changelog
+* Mon Jan 18 2021 Sjoerd Mullender  - 11.39.11-20210118
+- Rebuilt.
+- GH#3772: Any user can grant a role.
+
 * Mon Jan 11 2021 Sjoerd Mullender  - 11.39.9-20210111
 - Rebuilt.
 - GH#6862: mserver5: crashes under update_table() when calling lib_sql.so
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1219,7 +1219,7 @@ void freeVariable(MalBlkPtr mb, int vari
 void garbageCollector(Client cntxt, MalBlkPtr mb, MalStkPtr stk, int flag);
 void garbageElement(Client cntxt, ValPtr v);
 str generatorRef;
-MALfcn getAddress(str modname, str fcnname);
+MALfcn getAddress(const char *modname, const char *fcnname);
 str getArgDefault(MalBlkPtr mb, InstrPtr p, int idx);
 ptr getArgReference(MalStkPtr stk, InstrPtr pci, int k);
 int getAtomIndex(const char *nme, size_t len, int deftpe);
@@ -1346,7 +1346,7 @@ str likeselectRef;
 str likethetaselectRef;
 str likeuselectRef;
 str listRef;
-str loadLibrary(str modulename, int flag);
+str loadLibrary(const char *modulename, int flag);
 char *locate_file(const char *basename, const char *ext, bit recurse);
 str lockRef;
 str lookupRef;
@@ -1361,8 +1361,8 @@ str malExtraModulesBoot(Client c, str ex
 str malInclude(Client c, str name, int listing);
 str malIncludeModules(Client c, char *modules[], int listing, int embedded);
 str malIncludeString(Client c, const str name, const str mal, int listing, 
MALfcn address);
-int malLibraryEnabled(str name);
-char *malLibraryHowToEnable(str name);
+int malLibraryEnabled(const char *name);
+char *malLibraryHowToEnable(const char *name);
 int malProfileMode;
 str malRef;
 void mal_atom_reset(void);
diff --git a/clients/examples/C/bincopydata.c b/clients/examples/C/bincopydata.c
--- a/clients/examples/C/bincopydata.c
+++ b/clients/examples/C/bincopydata.c
@@ -1,45 +1,12 @@
 #include "bincopydata.h"
 
+#ifdef _MSC_VER
+#include 
+#include 
+#endif
+
 static char *exe_name = "";
 
-static struct gen {
-   char *name;
-   void (*gen)(FILE *f, bool byteswap, long nrecs);
-} generators[];
-
-_Noreturn static void croak(int status, const char *msg, ...)
-   __attribute__((__format__(__printf__, 2, 3)));
-
-/* Format the message and write it to stderr. Then exit with the given status.
- * If status is 1, include USAGE in the message.
- * Otherwise, if errno is set, include the error message.
- */
-static void
-croak(int status, const char *ctx, ...)
-{
-   va_list ap;
-
-   fprintf(stderr, "Error: ");
-   if (ctx != NULL) {
-   fprintf(stderr, " ");
-   va_start(ap, ctx);
-   vfprintf(stderr, ctx, ap);
-   va_end(ap);
-   }
-   fprintf(stderr, "\n");
-   if (errno) {
-   fprintf(stderr, "Possibly due to: %s\n", strerror(errno));
-   } else if (status == 1) {
-   fprintf(stderr, "USAGE: %s TYPE NRECS DESTFILE\n", exe_name);
-   fprintf(stderr, "TYPE:\n");
-   for (struct gen *g = generators; g->name != NULL; g++) {
-   fprintf(stderr, "  - %s\n", g->name);
-   }
-   }
-   exit(status);
-}
-
-
 static void
 gen_tinyints(FILE *f, bool byteswap, long nrecs)
 {
@@ -247,7 +214,10 @@ gen_json(FILE *f, bool byteswap, long nr
}
 }
 
-static struct gen generators[] = {
+static struct gen {
+   char *name;
+   void (*gen)(FILE *f, bool byteswap, long nrecs);
+} generators[] = {
{ "ints", gen_ints },
{ "more_ints", gen_more_ints },
{ "null_ints", gen_null_ints },
@@ -286,6 +256,38 @@ static struct gen generators[] = {
{ NULL, NULL },
 };
 
+_Noreturn static void croak(int status, const char *msg, ...)
+   __attribute__((__format__(__printf__, 2, 3)));
+
+/* Format the message and write it to stderr. Then exit with the given status.
+ * If status is 1, include USAGE in the message.
+ * Otherwise, if errno is set, include the error message.
+ */
+static void
+croak(int status, const char *ctx, ...)
+{
+   

MonetDB: nospare - merged with default

2021-01-15 Thread Niels Nes
Changeset: 8501fd99054c for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8501fd99054c
Branch: nospare
Log Message:

merged with default


diffs (221 lines):

diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -4206,6 +4206,7 @@ Running database upgrade commands:
 set schema "sys";
 ALTER TABLE sys.keywords SET READ WRITE;
 DELETE FROM sys.keywords where keyword = 'STREAM';
+INSERT INTO sys.keywords VALUES ('BIG'), ('LITTLE'), ('NATIVE'), ('ENDIAN');
 ALTER TABLE sys.table_types SET READ WRITE;
 DELETE FROM sys.table_types where table_type_id = 4;
 ALTER TABLE sys.function_types SET READ WRITE;
diff --git 
a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128
--- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128
+++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128
@@ -4206,6 +4206,7 @@ Running database upgrade commands:
 set schema "sys";
 ALTER TABLE sys.keywords SET READ WRITE;
 DELETE FROM sys.keywords where keyword = 'STREAM';
+INSERT INTO sys.keywords VALUES ('BIG'), ('LITTLE'), ('NATIVE'), ('ENDIAN');
 ALTER TABLE sys.table_types SET READ WRITE;
 DELETE FROM sys.table_types where table_type_id = 4;
 ALTER TABLE sys.function_types SET READ WRITE;
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
@@ -3611,6 +3611,7 @@ Running database upgrade commands:
 set schema "sys";
 ALTER TABLE sys.keywords SET READ WRITE;
 DELETE FROM sys.keywords where keyword = 'STREAM';
+INSERT INTO sys.keywords VALUES ('BIG'), ('LITTLE'), ('NATIVE'), ('ENDIAN');
 ALTER TABLE sys.table_types SET READ WRITE;
 DELETE FROM sys.table_types where table_type_id = 4;
 ALTER TABLE sys.function_types SET READ WRITE;
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit
@@ -3611,6 +3611,7 @@ Running database upgrade commands:
 set schema "sys";
 ALTER TABLE sys.keywords SET READ WRITE;
 DELETE FROM sys.keywords where keyword = 'STREAM';
+INSERT INTO sys.keywords VALUES ('BIG'), ('LITTLE'), ('NATIVE'), ('ENDIAN');
 ALTER TABLE sys.table_types SET READ WRITE;
 DELETE FROM sys.table_types where table_type_id = 4;
 ALTER TABLE sys.function_types SET READ WRITE;
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
@@ -4280,6 +4280,7 @@ Running database upgrade commands:
 set schema "sys";
 ALTER TABLE sys.keywords SET READ WRITE;
 DELETE FROM sys.keywords where keyword = 'STREAM';
+INSERT INTO sys.keywords VALUES ('BIG'), ('LITTLE'), ('NATIVE'), ('ENDIAN');
 ALTER TABLE sys.table_types SET READ WRITE;
 DELETE FROM sys.table_types where table_type_id = 4;
 ALTER TABLE sys.function_types SET READ WRITE;
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64
@@ -3611,6 +3611,7 @@ Running database upgrade commands:
 set schema "sys";
 ALTER TABLE sys.keywords SET READ WRITE;
 DELETE FROM sys.keywords where keyword = 'STREAM';
+INSERT INTO sys.keywords VALUES ('BIG'), ('LITTLE'), ('NATIVE'), ('ENDIAN');
 ALTER TABLE sys.table_types SET READ WRITE;
 DELETE FROM sys.table_types where table_type_id = 4;
 ALTER TABLE sys.function_types SET READ WRITE;
diff --git 
a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128
@@ -4280,6 +4280,7 @@ Running database upgrade commands:
 set schema "sys";
 ALTER TABLE sys.keywords SET READ WRITE;
 DELETE FROM sys.keywords where keyword = 'STREAM';
+INSERT INTO sys.keywords VALUES ('BIG'), ('LITTLE'), ('NATIVE'), ('ENDIAN');
 ALTER TABLE sys.table_types SET READ WRITE;
 DELETE FROM sys.table_types where table_type_id = 4;
 ALTER TABLE sys.function_types SET READ WRITE;
diff --git 

MonetDB: nospare - merged

2021-01-12 Thread Niels Nes
Changeset: a2c17e7d936e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a2c17e7d936e
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_upgrades.c
sql/server/rel_optimizer.c
tools/monetdbe/monetdbe.c
Branch: nospare
Log Message:

merged


diffs (truncated from 35484 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -791,3 +791,5 @@ cb4b3f021774b60ffd84c3004d341ec04de736f3
 bd91504a03736565fb2dff13cd4c94c738e81aa0 Oct2020_release
 ac8254a47e87d0be9df2a623e2c2fcf67c0f982d Oct2020_7
 ac8254a47e87d0be9df2a623e2c2fcf67c0f982d Oct2020_SP1_release
+929f5e280bc1532a2bfaab127ca7915dc3b69a33 Oct2020_9
+929f5e280bc1532a2bfaab127ca7915dc3b69a33 Oct2020_SP2_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -84,7 +84,7 @@ Group: Applications/Databases
 License: MPLv2.0
 URL: https://www.monetdb.org/
 BugURL: https://bugs.monetdb.org/
-Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP1/%{name}-%{version}.tar.bz2
+Source: 
https://www.monetdb.org/downloads/sources/Oct2020-SP2/%{name}-%{version}.tar.bz2
 
 # The Fedora packaging document says we need systemd-rpm-macros for
 # the _unitdir and _tmpfilesdir macros to exist; however on RHEL 7
@@ -823,6 +823,35 @@ else
 fi
 
 %changelog
+* Mon Jan 11 2021 Sjoerd Mullender  - 11.39.9-20210111
+- Rebuilt.
+- GH#6862: mserver5: crashes under update_table() when calling lib_sql.so
+  ( max_clients = 2048)
+- GH#7002: monetdb stop fails
+- GH#7012: mclient enters an infinite loop when a file on the command line
+  does not exist
+- GH#7013: Select * on grouped view: wrong error "cannot use non GROUP BY
+  column 'a1' in query results without an aggregate function"
+- GH#7017: mal seems to leak in functions
+- GH#7020: release an older savepoint causes "BATproject2: does not match
+  always"
+- GH#7021: savepoints crash mserver5
+- GH#7022: transaction with an unreleased savepoint not properly persisted
+- GH#7023: CREATE VIEW: SELECT: cannot use non GROUP BY column '%1' in
+  query results without an aggregate function
+- GH#7024: DELETE FROM or TRUNCATE on freshly created table leads to
+  loosing all further inserts in same transaction
+- GH#7030: DROP TABLE with AUTO_INCREMENT doesn't drop sequence causing
+  left-over dependency
+- GH#7034: User with sysadmin role cannot create another user
+- GH#7035: UPDATE and SELECT column privileges
+
+* Thu Dec 10 2020 Pedro Ferreira  - 
11.39.9-20210111
+- sql: CREATE [OR REPLACE] TRIGGER schema_name.trigger_name is now disallowed,
+  because the trigger will be stored on the same schema as the table it
+  refers to. Use a schema-qualified on the table reference (ie ON clause)
+  when necessary.
+
 * Wed Nov 18 2020 Sjoerd Mullender  - 11.39.7-20201118
 - Rebuilt.
 - BZ#6890: Add support of xz/lzma (de)compression on MS Windows
@@ -1359,4278 +1388,3 @@ fi
   thereby avoiding the interaction with other queries, but loosing
   insight of competing queries. The stethoscope should be used for that.
 
-* Sat Feb 22 2020 Sjoerd Mullender  - 11.35.19-20200222
-- Rebuilt.
-- BZ#6829: NTILE window function returns incorrect results
-
-* Fri Feb 21 2020 Sjoerd Mullender  - 11.35.17-20200221
-- Rebuilt.
-- BZ#6827: CUME_DIST window function returns incorrect results
-
-* Mon Feb 17 2020 Sjoerd Mullender  - 11.35.15-20200217
-- Rebuilt.
-- BZ#6817: running analyze on a schema which contains a stream table
-  stops with an error
-- BZ#6819: functions do not persist
-
-* Wed Feb 12 2020 Sjoerd Mullender  - 11.35.13-20200212
-- Rebuilt.
-
-* Tue Feb 11 2020 Sjoerd Mullender  - 11.35.11-20200211
-- Rebuilt.
-- BZ#6805: Using the cascade operator in a drop table statement ends in
-  an exit from the Monetdb shell.
-- BZ#6807: Median_avg and quantile_avg ignore NULL values
-- BZ#6815: query with ifthenelse() crashes mserver5
-- BZ#6816: Monetdb Crashes on INSERT statement after ALTER statement in
-  another connection
-
-* Wed Dec 18 2019 Sjoerd Mullender  - 11.35.9-20191218
-- Rebuilt.
-- BZ#6804: DNS resolution of 0.0.0.0 fails on recent Ubuntus
-
-* Tue Dec 17 2019 Sjoerd Mullender  - 11.35.7-20191217
-- Rebuilt.
-
-* Thu Dec 12 2019 Sjoerd Mullender  - 11.35.5-20191212
-- Rebuilt.
-- BZ#6723: columns aliases duplicates should not be allowed. automatic
-  aliasing required.
-- BZ#6724: Prepare confuses types when more than one argument is used
-- BZ#6726: Python aggregation does not create aggr_group when aggregating
-  over all rows
-- BZ#6765: GRANT SELECT privilege on a subset of table columns results
-  in access denied error when selecting the same columns from the table
-- BZ#6790: Count distinct giving wrong results
-- BZ#6791: str_to_time('11:40', '%H:%M') creates wrong time value
-- BZ#6792: JSON path compiler accepts invalid input
-- BZ#6793: cast(interval second value to int or decimal) is wrong (by
-  a factor of 1000), cast(interval month value to 

MonetDB: nospare - merged with default

2021-01-07 Thread Niels Nes
Changeset: c412fe1e990b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c412fe1e990b
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_statement.c
sql/server/rel_rel.c
Branch: nospare
Log Message:

merged with default


diffs (truncated from 644 to 300 lines):

diff --git a/debian/libmonetdb-client12.install 
b/debian/libmonetdb-client12.install
--- a/debian/libmonetdb-client12.install
+++ b/debian/libmonetdb-client12.install
@@ -1,2 +1,1 @@
-debian/tmp/usr/lib/x86_64-linux-gnu/libmapi.so.12 /usr/lib/x86_64-linux-gnu
-debian/tmp/usr/lib/x86_64-linux-gnu/libmapi.so.12.* /usr/lib/x86_64-linux-gnu
+debian/tmp/usr/lib/x86_64-linux-gnu/libmapi.so.* /usr/lib/x86_64-linux-gnu
diff --git a/debian/libmonetdb-stream14.install 
b/debian/libmonetdb-stream14.install
--- a/debian/libmonetdb-stream14.install
+++ b/debian/libmonetdb-stream14.install
@@ -1,2 +1,1 @@
-debian/tmp/usr/lib/x86_64-linux-gnu/libstream.so.14 usr/lib/x86_64-linux-gnu
-debian/tmp/usr/lib/x86_64-linux-gnu/libstream.so.14.* usr/lib/x86_64-linux-gnu
+debian/tmp/usr/lib/x86_64-linux-gnu/libstream.so.* usr/lib/x86_64-linux-gnu
diff --git a/debian/libmonetdb21.install b/debian/libmonetdb21.install
--- a/debian/libmonetdb21.install
+++ b/debian/libmonetdb21.install
@@ -1,2 +1,1 @@
-debian/tmp/usr/lib/x86_64-linux-gnu/libbat.so.21 usr/lib/x86_64-linux-gnu
-debian/tmp/usr/lib/x86_64-linux-gnu/libbat.so.21.* usr/lib/x86_64-linux-gnu
+debian/tmp/usr/lib/x86_64-linux-gnu/libbat.so.* usr/lib/x86_64-linux-gnu
diff --git a/debian/libmonetdbe1.install b/debian/libmonetdbe1.install
--- a/debian/libmonetdbe1.install
+++ b/debian/libmonetdbe1.install
@@ -1,2 +1,1 @@
-debian/tmp/usr/lib/x86_64-linux-gnu/libmonetdbe.so.1 usr/lib/x86_64-linux-gnu
-debian/tmp/usr/lib/x86_64-linux-gnu/libmonetdbe.so.1.* usr/lib/x86_64-linux-gnu
+debian/tmp/usr/lib/x86_64-linux-gnu/libmonetdbe.so.* usr/lib/x86_64-linux-gnu
diff --git a/monetdb5/modules/atoms/uuid.c b/monetdb5/modules/atoms/uuid.c
--- a/monetdb5/modules/atoms/uuid.c
+++ b/monetdb5/modules/atoms/uuid.c
@@ -407,7 +407,7 @@ UUIDhash(const void *v)
(ulng) u->u[10] << 40 | (ulng) u->u[11] << 32 |
(ulng) u->u[12] << 24 | (ulng) u->u[13] << 16 |
(ulng) u->u[14] << 8 | (ulng) u->u[15];
-   /* we're not using mix_hge since this we way get the same result
+   /* we're not using mix_hge since this way we get the same result
 * on systems with and without 128 bit integer support */
return (BUN) (mix_lng(u1) ^ mix_lng(u2));
 }
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
@@ -31,6 +31,13 @@ static stmt * subrel_bin(backend *be, sq
 
 static stmt *check_types(backend *be, sql_subtype *ct, stmt *s, check_type 
tpe);
 
+static void
+clean_mal_statements(backend *be, int oldstop, int oldvtop)
+{
+   MSresetInstructions(be->mb, oldstop);
+   freeVariables(be->client, be->mb, NULL, oldvtop);
+}
+
 static stmt *
 stmt_selectnil( backend *be, stmt *col)
 {
@@ -429,6 +436,8 @@ handle_in_exps(backend *be, sql_exp *ce,
 
/* The actual in-value-list should not contain duplicates to 
ensure that final join results are unique. */
s = distinct_value_list(be, nl, _null_value);
+   if (!s)
+   return NULL;
 
if (last_null_value) {
/* The actual in-value-list should not contain null 
values. */
@@ -1164,7 +1173,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}   break;
case e_cmp: {
stmt *l = NULL, *r = NULL, *r2 = NULL;
-   int swapped = 0, is_select = 0;
+   int swapped = 0, is_select = 0, oldvtop, oldstop;
sql_exp *re = e->r, *re2 = e->f;
 
/* general predicate, select and join */
@@ -1177,10 +1186,13 @@ exp_bin(backend *be, sql_exp *e, stmt *l
ops = sa_list(sql->sa);
args = e->l;
for( n = args->h; n; n = n->next ) {
+   oldvtop = be->mb->vtop;
+   oldstop = be->mb->stop;
s = NULL;
if (!swapped)
s = exp_bin(be, n->data, left, NULL, 
grp, ext, cnt, NULL, depth+1, 0, push);
if (!s && (first || swapped)) {
+   clean_mal_statements(be, oldstop, 
oldvtop);
s = exp_bin(be, n->data, right, NULL, 
grp, ext, cnt, NULL, depth+1, 0, push);
swapped = 1;
}
@@ -1202,7 +1214,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
r = stmt_list(be, ops);
 
-   if (left 

MonetDB: nospare - merged with default

2021-01-04 Thread Niels Nes
Changeset: 7d767181bdc6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=7d767181bdc6
Modified Files:
sql/server/rel_schema.c
sql/server/sql_privileges.c
Branch: nospare
Log Message:

merged with default


diffs (72 lines):

diff --git 
a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows
 
b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows
--- 
a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows
+++ 
b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out.Windows
@@ -117,7 +117,7 @@ end user.main;
 % clob # type
 % 235 # length
 function user.main():void;
-X_1:void := querylog.define("explain copy into ttt from 
E\\'tmp/xyz\\';":str, "user_0":str, 22:int);
+querylog.define("explain copy into ttt from E\\'tmp/xyz\\';":str, 
"user_0":str, 22:int);
 X_4:int := sql.mvc();
 (X_28:bat[:int], X_29:bat[:int], X_30:bat[:int]) := 
sql.copy_from(0x0049B72361C0:ptr, "|":str, "\n":str, nil:str, "null":str, 
"\\tmp/xyz":str, -1:lng, 0:lng, 0:int, 0:int, nil:str, 0:int, 1:int);
 X_32:int := sql.append(X_4:int, "sys":str, "ttt":str, 
"averylongcolumnnametomakeitlargee":str,
 X_28:bat[:int]);
@@ -159,7 +159,7 @@ end user.main;
 % clob # type
 % 235 # length
 function user.main():void;
-X_1:void := querylog.define("explain copy into ttt from 
\\'Z:/tmp/xyz\\';":str, "user_0":str, 22:int);
+querylog.define("explain copy into ttt from \\'Z:/tmp/xyz\\';":str, 
"user_0":str, 22:int);
 X_4:int := sql.mvc();
 (X_28:bat[:int], X_29:bat[:int], X_30:bat[:int]) := 
sql.copy_from(0x0049B72361C0:ptr, "|":str, "\n":str, nil:str, "null":str, 
"Z:/tmp/xyz":str, -1:lng, 0:lng, 0:int, 0:int, nil:str, 0:int, 1:int);
 X_32:int := sql.append(X_4:int, "sys":str, "ttt":str, 
"averylongcolumnnametomakeitlargee":str,
 X_28:bat[:int]);
diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c
--- a/sql/server/rel_schema.c
+++ b/sql/server/rel_schema.c
@@ -1349,6 +1349,8 @@ sql_drop_table(sql_query *query, dlist *
}
return NULL;
}
+   if (isDeclaredTable(t))
+   return sql_error(sql, 02, SQLSTATE(42000) "DROP TABLE: cannot 
drop a declared table");
 
return rel_drop(sql->sa, ddl_drop_table, t->s->base.name, tname, nr, 
if_exists);
 }
@@ -1680,6 +1682,8 @@ rel_grant_or_revoke_table(mvc *sql, dlis
 
if (!(t = find_table_or_view_on_scope(sql, NULL, sname, tname, err, 
false)))
return NULL;
+   if (isDeclaredTable(t))
+   return sql_error(sql, 02, SQLSTATE(42000) "Cannot %s on a 
declared table", err);
for (dnode *gn = grantees->h; gn; gn = gn->next) {
char *grantee = gn->data.sval;
 
@@ -1815,6 +1819,8 @@ rel_create_index(mvc *sql, char *iname, 
 
if (!(t = find_table_or_view_on_scope(sql, NULL, sname, tname, "CREATE 
INDEX", false)))
return NULL;
+   if (isDeclaredTable(t))
+   return sql_error(sql, 02, SQLSTATE(42000) "CREATE INDEX: cannot 
create index on a declared table");
if (!mvc_schema_privs(sql, t->s))
return sql_error(sql, 02, SQLSTATE(42000) "CREATE INDEX: access 
denied for %s to schema '%s'", get_string_global_var(sql, "current_user"), 
t->s->base.name);
if ((i = mvc_bind_idx(sql, t->s, iname)))
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
@@ -136,6 +136,8 @@ sql_grant_table_privs( mvc *sql, char *g
 
if (!(t = find_table_or_view_on_scope(sql, NULL, sname, tname, "GRANT", 
false)))
throw(SQL,"sql.grant_table", "%s", sql->errstr);
+   if (isDeclaredTable(t))
+   throw(SQL,"sql.grant_table", SQLSTATE(42000) "GRANT: cannot 
grant on a declared table");
 
allowed = schema_privs(grantor, t->s);
 
@@ -272,6 +274,8 @@ sql_revoke_table_privs( mvc *sql, char *
 
if (!(t = find_table_or_view_on_scope(sql, NULL, sname, tname, 
"REVOKE", false)))
throw(SQL,"sql.revoke_table","%s", sql->errstr);
+   if (isDeclaredTable(t))
+   throw(SQL,"sql.revoke_table", SQLSTATE(42000) "REVOKE: cannot 
revoke on a declared table");
 
allowed = schema_privs(grantor, t->s);
if (!allowed)
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: nospare - merged with default

2021-01-04 Thread Niels Nes
Changeset: 23951c4d7c2b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=23951c4d7c2b
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql.c
sql/backends/monet5/sql_gencode.c
sql/backends/monet5/sql_result.c
sql/backends/monet5/sql_statement.c
Branch: nospare
Log Message:

merged with default


diffs (truncated from 1711 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
@@ -54,7 +54,7 @@ SQLhelp sqlhelp1[] = {
 "",
 "ALTER SCHEMA [ IF EXISTS ] ident RENAME TO ident",
 "ident",
-"See also 
https://www.monetdb.org/Documentation/SQLreference/TableDefinitions/AlterStatement"},
+"See also 
https://www.monetdb.org/Documentation/SQLReference/DataDefinition/SchemaDefinitions"},
{"ALTER SEQUENCE",
 "",
 "ALTER SEQUENCE qname [ AS seq_int_datatype] [ RESTART [WITH intval]] 
[INCREMENT BY intval]\n"
@@ -191,7 +191,7 @@ SQLhelp sqlhelp1[] = {
 "",
 "CREATE REPLICA TABLE [ IF NOT EXISTS ] qname table_source",
 NULL,
-"See also 
https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/TransactionReplication"},
+"See also 
https://www.monetdb.org/Documentation/SQLReference/TableDefinitions"},
{"CREATE ROLE",
 "Create a new role. You can grant privileges to a role and next\n"
 "grant a role (or multiple roles) to specific users",
@@ -246,7 +246,7 @@ SQLhelp sqlhelp1[] = {
 "RETURNS function_return_data_type\n"
 "EXTERNAL NAME ident ',' ident",
 "qname,param,function_return_data_type,ident",
-"See also 
https://www.monetdb.org/Documentation/SQLreference/ProgrammingSQL/Functions"},
+"See also 
https://www.monetdb.org/Documentation/SQLReference/DataManipulation/WindowFunctions"},
{"CURRENT_DATE",
 "Pseudo column or function to get the current date",
 "CURRENT_DATE [ '(' ')' ]",
@@ -291,7 +291,7 @@ SQLhelp sqlhelp1[] = {
 "Debug a SQL statement using MAL debugger",
 "DEBUG statement",
 NULL,
-
"https://www.monetdb.org/Documentation/SQLreference/RuntimeFeatures/Debug"},
+"See also 
https://www.monetdb.org/Documentation/SQLreference/RuntimeFeatures/Debug"},
{"DECLARE",
 "Define a local variable",
 "DECLARE ident_list data_type",
diff --git a/common/stream/stream.h b/common/stream/stream.h
--- a/common/stream/stream.h
+++ b/common/stream/stream.h
@@ -232,7 +232,6 @@ stream_export stream *bs_stream(stream *
 typedef enum {
PROTOCOL_AUTO = 0, // unused
PROTOCOL_9 = 1, // mal_mapi.c, mal_client.c;
-   PROTOCOL_10 = 2, // mal_mapi.c, sql_result.c
PROTOCOL_COLUMNAR = 3 // sql_result.c
 } protocol_version;
 
diff --git a/common/utils/mcrypt.c b/common/utils/mcrypt.c
--- a/common/utils/mcrypt.c
+++ b/common/utils/mcrypt.c
@@ -45,7 +45,6 @@ mcrypt_getHashAlgorithms(void)
 * desire.
 */
static const char *algorithms =
-   "PROT10"
 #ifdef HAVE_RIPEMD160_UPDATE
",RIPEMD160"
 #endif
diff --git 
a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out 
b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out
--- a/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out
+++ b/monetdb5/extras/mal_optimizer_template/Tests/opt_sql_append.stable.out
@@ -17,7 +17,7 @@
 % clob # type
 % 235 # length
 function user.main():void;
-X_1:void := querylog.define("explain copy into ttt from 
\\'/tmp/xyz\\';":str, "sequential_pipe":str, 22:int);
+querylog.define("explain copy into ttt from \\'/tmp/xyz\\';":str, 
"sequential_pipe":str, 22:int);
 X_4:int := sql.mvc();
 (X_28:bat[:int], X_29:bat[:int], X_30:bat[:int]) := 
sql.copy_from(0x7fc1401da5c0:ptr, "|":str, "\n":str, nil:str, "null":str, 
"/tmp/xyz":str, -1:lng, 0:lng, 0:int, 0:int, nil:str, 0:int, 1:int);
 X_32:int := sql.append(X_4:int, "sys":str, "ttt":str, 
"averylongcolumnnametomakeitlargee":str,
 X_28:bat[:int]);
@@ -77,7 +77,7 @@ end user.main;
 % clob # type
 % 235 # length
 function user.main():void;
-X_1:void := querylog.define("explain copy into ttt from 
\\'/tmp/xyz\\';":str, "user_0":str, 22:int);
+querylog.define("explain copy into ttt from \\'/tmp/xyz\\';":str, 
"user_0":str, 22:int);
 X_4:int := sql.mvc();
 (X_28:bat[:int], X_29:bat[:int], X_30:bat[:int]) := 
sql.copy_from(0x7fc1401da5c0:ptr, "|":str, "\n":str, nil:str, "null":str, 
"/tmp/xyz":str, -1:lng, 0:lng, 0:int, 0:int, nil:str, 0:int, 1:int);
 X_32:int := sql.append(X_4:int, "sys":str, "ttt":str, 

MonetDB: nospare - merged with default

2021-01-04 Thread Niels Nes
Changeset: 00c3b5eaa572 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=00c3b5eaa572
Modified Files:
sql/backends/monet5/sql_user.c
sql/server/rel_updates.c
sql/server/sql_privileges.c
Branch: nospare
Log Message:

merged with default


diffs (truncated from 647 to 300 lines):

diff --git a/documentation/source/developers_handbook.rst 
b/documentation/source/developers_handbook.rst
--- a/documentation/source/developers_handbook.rst
+++ b/documentation/source/developers_handbook.rst
@@ -100,4 +100,21 @@ index ``All`` file.
 Python tests API
 
 
-See many of the examples in ``sql/test/Users/Tests``.
+We are using ``pymonetdb`` client in our testing infrastructure heavily. All 
.py tests needs to log errors in ``stderror``
+and exit abnormally if failure is present. To ease up writing testing scripts 
the ``SQLTestCase`` class from ``MonetDBtesting`` 
+module can be utilized. Following is an example of the ``SQLTestCase`` API::
+
+from MonetDBtesting.sqltest import SQLTestCase
+
+from decimal import Decimal
+
+with SQLTestCase() as tc:
+# using default connection context
+tc.connect()
+# insert into non-existing table
+tc.execute('insert into foo values (888.42), 
(444.42);').assertFailed(err_code='42S02')
+tc.execute('create table foo (salary 
decimal(10,2));').assertSucceeded()
+tc.execute('insert into foo values (888.42), 
(444.42);').assertSucceeded().assertRowCount(2)
+tc.execute('select * from 
foo;').assertSucceeded().assertDataResultMatch([(Decimal('888.42'),), 
(Decimal('444.42'),)])
+
+For more examples check out tests in ``sql/test/Users/Tests``.
diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c
--- a/sql/backends/monet5/sql_user.c
+++ b/sql/backends/monet5/sql_user.c
@@ -35,7 +35,7 @@ monet5_drop_user(ptr _mvc, str user)
str err;
Client c = MCgetClient(m->clientid);
 
-   int grant_user = c->user;
+   oid grant_user = c->user;
c->user = MAL_ADMIN;
err = AUTHremoveUser(c, user);
c->user = grant_user;
@@ -166,7 +166,7 @@ monet5_create_user(ptr _mvc, str user, s
pwd = passwd;
}
/* add the user to the M5 authorisation administration */
-   int grant_user = c->user;
+   oid grant_user = c->user;
c->user = MAL_ADMIN;
ret = AUTHaddUser(, c, user, pwd);
c->user = grant_user;
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
@@ -1244,7 +1244,7 @@ merge_into_table(sql_query *query, dlist
mvc *sql = query->sql;
char *sname = qname_schema(qname), *tname = qname_schema_object(qname);
sql_table *t = NULL;
-   sql_rel *bt, *joined, *join_rel = NULL, *extra_project, *insert = NULL, 
*upd_del = NULL, *res = NULL;
+   sql_rel *bt, *joined, *join_rel = NULL, *extra_project, *insert = NULL, 
*upd_del = NULL, *res = NULL, *no_tid = NULL;
int processed = 0;
const char *bt_name;
 
@@ -1347,7 +1347,9 @@ merge_into_table(sql_query *query, dlist
 
//project joined values which didn't match on the join 
and insert them
extra_project = rel_project(sql->sa, join_rel, 
rel_projections(sql, joined, NULL, 1, 0));
-   extra_project = rel_setop(sql->sa, rel_dup(joined), 
extra_project, op_except);
+   no_tid = rel_project(sql->sa, rel_dup(joined), 
rel_projections(sql, joined, NULL, 1, 0));
+   extra_project = rel_setop(sql->sa, no_tid, 
extra_project, op_except);
+   rel_setop_set_exps(sql, extra_project, 
rel_projections(sql, extra_project, NULL, 1, 0));
 
if (!(insert = merge_generate_inserts(query, t, 
extra_project, sts->h->data.lval, sts->h->next->data.sym)))
return NULL;
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
@@ -842,11 +842,12 @@ sql_alter_user(mvc *sql, char *user, cha
if (strNil(user))
user = NULL;
/* USER == NULL -> current_user */
-   if (user != NULL && backend_find_user(sql, user) < 0)
-   throw(SQL,"sql.alter_user", SQLSTATE(42M32) "ALTER USER: no 
such user '%s'", user);
 
if (!admin_privs(sql->user_id) && !admin_privs(sql->role_id) && user != 
NULL && strcmp(user, get_string_global_var(sql, "current_user")) != 0)
throw(SQL,"sql.alter_user", SQLSTATE(M1M05) "Insufficient 
privileges to change user '%s'", user);
+
+   if (user != NULL && backend_find_user(sql, user) < 0)
+   throw(SQL,"sql.alter_user", SQLSTATE(42M32) "ALTER USER: no 
such user '%s'", user);
if (schema && (schema_id = sql_find_schema(sql, schema)) < 0)

MonetDB: nospare - merged with default

2021-01-04 Thread Niels Nes
Changeset: fde08e68dc41 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fde08e68dc41
Modified Files:
gdk/gdk_logger.c
gdk/gdk_logger.h
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_user.c
sql/server/rel_optimizer.c
sql/server/rel_updates.c
sql/storage/bat/bat_storage.c
sql/storage/store.c
Branch: nospare
Log Message:

merged with default


diffs (truncated from 2244 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -187,6 +187,8 @@ need this package, but you will also nee
 package, and most likely also %{name}-SQL-server5, as well as one or
 more client packages.
 
+%ldconfig_scriptlets
+
 %files
 %license COPYING
 %defattr(-,root,root)
@@ -572,6 +574,7 @@ used from the MAL level.
 %files -n MonetDB5-server-devel
 %defattr(-,root,root)
 %{_includedir}/monetdb/mal*.h
+%{_includedir}/monetdb/mel.h
 %{_libdir}/libmonetdb5.so
 %{_libdir}/pkgconfig/monetdb5.pc
 
@@ -635,6 +638,24 @@ configuration.
 %docdir %{_datadir}/doc/MonetDB-SQL
 %{_datadir}/doc/MonetDB-SQL/*
 
+%package SQL-server5-devel
+Summary: MonetDB5 SQL server modules
+Group: Applications/Databases
+Requires: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
+Requires: MonetDB5-server-devel%{?_isa} = %{version}-%{release}
+
+%description SQL-server5-devel
+MonetDB is a database management system that is developed from a
+main-memory perspective with use of a fully decomposed storage model,
+automatic index management, extensibility of data types and search
+accelerators.  It also has an SQL front end.
+
+This package contains files needed to develop SQL extensions.
+
+%files SQL-server5-devel
+%defattr(-,root,root)
+%{_includedir}/monetdb/sql*.h
+
 %package embedded
 Summary: MonetDB as an embedded library
 Group: Applications/Databases
@@ -847,10 +868,6 @@ sed -i 's|/var/run|/run|' \
 %{buildroot}%{_unitdir}/monetdbd.service
 %endif
 
-%post -p /sbin/ldconfig
-
-%postun -p /sbin/ldconfig
-
 %changelog
 * Wed Nov 18 2020 Sjoerd Mullender  - 11.39.7-20201118
 - Rebuilt.
diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py
--- a/NT/mksqlwxs.py
+++ b/NT/mksqlwxs.py
@@ -173,9 +173,10 @@ def main():
 print(r'')
 print(r'  ')
 id = comp(extend, id, 16,
-  sorted([r'include\monetdb\{}'.format(x) for x in filter(lambda 
x: (x.startswith('gdk') or x.startswith('monet') or x.startswith('mal')) and 
x.endswith('.h'), os.listdir(os.path.join(sys.argv[3], 'include', 'monetdb')))] 
+
+  sorted([r'include\monetdb\{}'.format(x) for x in filter(lambda 
x: (x.startswith('gdk') or x.startswith('monet') or x.startswith('mal') or 
x.startswith('sql')) and x.endswith('.h'), os.listdir(os.path.join(sys.argv[3], 
'include', 'monetdb')))] +
  [r'include\monetdb\mapi.h',
   r'include\monetdb\matomic.h',
+  r'include\monetdb\mel.h',
   r'include\monetdb\mstring.h',
   r'include\monetdb\stream.h',
   r'include\monetdb\stream_socket.h']),
diff --git a/buildtools/coverity_model.c b/buildtools/coverity_model.c
--- a/buildtools/coverity_model.c
+++ b/buildtools/coverity_model.c
@@ -20,8 +20,13 @@
  * author: Sjoerd Mullender
  */
 
+int
+rand(void)
+{
+   /* ignore */
+}
+
 typedef enum { GDK_FAIL, GDK_SUCCEED } gdk_return;
-typedef struct {} *MalBlkPtr;
 
 void
 GDKfree(void *blk)
@@ -51,7 +56,8 @@ GDKzalloc(size_t size)
 {
void *p = GDKmalloc(size);
if (p) {
-   for (size_t i = 0; i < size; i++)
+   size_t i;
+   for (i = 0; i < size; i++)
((char *) p)[i] = 0;
}
return p;
@@ -136,6 +142,24 @@ GDKmremap(const char *path, int mode, vo
return p;
 }
 
+typedef struct {} *MalBlkPtr;
+enum malexception {
+   MAL,
+   ILLARG /*,
+   OUTOFBNDS,
+   IO,
+   INVCRED,
+   OPTIMIZER,
+   STKOF,
+   SYNTAX,
+   TYPE,
+   LOADER,
+   PARSE,
+   ARITH,
+   PERMD,
+   SQL */
+};
+
 char *
 createException(enum malexception type, const char *fcn, const char *format, 
...)
 {
@@ -177,8 +201,8 @@ freeException(char *p)
 char *
 concatErrors(char *err1, const char *err2)
 {
+   char *p;
freeException(err1);
-   char *p;
p = __coverity_alloc_nosize__();
__coverity_mark_as_afm_allocated__(p, "freeException");
return p;
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -1301,7 +1301,7 @@ str io_stdin(Client cntxt, MalBlkPtr mb,
 str io_stdout(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
 int isBlocking(InstrPtr p);
 int isDelta(InstrPtr q);
-int isExceptionVariable(str nme);
+bool isExceptionVariable(const char *nme);
 int 

MonetDB: nospare - merged

2021-01-04 Thread Niels Nes
Changeset: 9366974b94c0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9366974b94c0
Branch: nospare
Log Message:

merged


diffs (truncated from 301 to 300 lines):

diff --git a/documentation/source/developers_handbook.rst 
b/documentation/source/developers_handbook.rst
--- a/documentation/source/developers_handbook.rst
+++ b/documentation/source/developers_handbook.rst
@@ -70,7 +70,7 @@ directory where they reside::
 
 
 Adding sqllogic test
--
+
 
 See ``_ for detail 
information 
 on how to structure sqllogic test if you desire to make one by hand. We have 
extended the 
diff --git a/documentation/source/windowsbuild.rst 
b/documentation/source/windowsbuild.rst
deleted file mode 100644
--- a/documentation/source/windowsbuild.rst
+++ /dev/null
@@ -1,121 +0,0 @@
-.. This Source Code Form is subject to the terms of the Mozilla Public
-.. License, v. 2.0.  If a copy of the MPL was not distributed with this
-.. file, You can obtain one at http://mozilla.org/MPL/2.0/.
-..
-.. Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V.
-
-.. This document is written in reStructuredText (see
-   http://docutils.sourceforge.net/ for more information).
-   Use ``rst2html.py`` to convert this file to HTML.
-
-Building MonetDB On Windows
-+++
-
-In this document we describe how to build the MonetDB suite of
-programs on Windows using the sources from `our source repository`__.
-This document is mainly targeted at building on Windows on a 32-bit
-architecture, but there are notes throughout about building on Windows
-on a 64-bit architecture which is indicated with Windows64.  We have
-successfully built on Windows XP, Windows Server, and Windows 7.
-
-.. _MonetDB: https://dev.monetdb.org/hg/MonetDB/
-
-__ MonetDB_
-
-Introduction
-
-
-The MonetDB suite of programs consists of a number of components which
-we will describe briefly here.  The section names are the names of the
-top-level folders in the Mercurial clone.
-
-Note that in branches up to and including Oct2010 the build process
-was different.  This document describes the build process for the
-branch this document is part of.  Use the command ``hg branch`` to
-find out the name of the branch.
-
-buildtools
---
-
-The buildtools component contains tools that are used to build the
-other components.  This component is required, but not all parts of
-this component are required for all configurations.
-
-common
---
-
-Also known as the MonetDB Common component contains some generally
-useful libraries.  This component is required.
-
-gdk

-
-Also known as the Goblin Database Kernel contains the database kernel,
-i.e. the heart of MonetDB.  This component is required.
-
-clients

-
-Also known as the MonetDB Client component contains a library which
-forms the basis for communicating with the MonetDB server components,
-and some interface programs that use this library to communicate with
-the server.  This component is required.
-
-monetdb5
-
-
-The MonetDB5 Server component is the database server.  It uses MAL
-(the MonetDB Algebra Language) as programming interface.  This
-component is required.
-
-sql

-
-Also known as MonetDB SQL, this component provides an SQL frontend to
-MonetDB5.  This component is required if you need SQL support.
-
-tools
--
-
-The tools component contains two parts.  The mserver part is the
-actual database server binary and is required.  The merovingian part
-is not used on Windows.
-
-geom
-
-
-The geom component provides a module for the MonetDB SQL frontend.
-This component is optional.
-
-testing

-
-The testing component contains some files and programs we use for
-testing the MonetDB suite.  This component is optional.
-
-Prerequisites
-=
-
-In order to compile the MonetDB suite of programs, several other
-programs and libraries need to be installed.  Some further programs
-and libraries can be optionally installed to enable optional features.
-The required programs and libraries are listed in this section, the
-following section lists the optional programs and libraries.
-
-Chocolatey
---
-
-Although Chocolatey_ is not a prerequisite per se, it makes
-installing and maintaining some of the other prerequisites a lot
-easier.  Therefore we recommend installing chocolatey.  Instructions
-are on their website__.
-
-We have installed the following programs using Chocolatey_::
-
-  choco install ActivePerl ant cmake ruby
-  choco install python3 python3-x86_32
-
-.. _Chocolatey: https://chocolatey.org/
-
-__ Chocolatey_
-
diff --git a/sql/test/Users/Tests/All b/sql/test/Users/Tests/All
--- a/sql/test/Users/Tests/All
+++ b/sql/test/Users/Tests/All
@@ -12,6 +12,7 @@ schemaRights
 table_privs
 table
 view_privs
+view_privs_chain
 unknown_user
 userCallFunction
 withGrantOption
diff --git 

MonetDB: nospare - merged with default

2021-01-04 Thread Niels Nes
Changeset: b557019bea76 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b557019bea76
Modified Files:
sql/backends/monet5/sql.c
sql/backends/monet5/sql_upgrades.c
sql/include/sql_catalog.h
sql/server/rel_updates.c
sql/server/sql_mvc.c
sql/server/sql_privileges.c
sql/storage/sql_catalog.c
Branch: nospare
Log Message:

merged with default


diffs (truncated from 14766 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -9513,7 +9513,7 @@ stdout of test 'MAL-signatures` in direc
 [ "sqlcatalog","alter_seq","pattern sqlcatalog.alter_seq(X_1:str, 
X_2:str, X_3:ptr, X_4:lng):void ",   "SQLalter_seq;",""  ]
 [ "sqlcatalog","alter_set_table",  "pattern 
sqlcatalog.alter_set_table(X_1:str, X_2:str, X_3:int):void ",  
"SQLalter_set_table;",  ""  ]
 [ "sqlcatalog","alter_table",  "pattern 
sqlcatalog.alter_table(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", 
"SQLalter_table;",  ""  ]
-[ "sqlcatalog","alter_user",   "pattern sqlcatalog.alter_user(X_1:str, 
X_2:str, X_3:int, X_4:str, X_5:str):void ", "SQLalter_user;",   ""  
]
+[ "sqlcatalog","alter_user",   "pattern sqlcatalog.alter_user(X_1:str, 
X_2:str, X_3:int, X_4:str, X_5:str, X_6:str):void ","SQLalter_user;",   
""  ]
 [ "sqlcatalog","comment_on",   "pattern sqlcatalog.comment_on(X_1:int, 
X_2:str):void ","SQLcomment_on;",   ""  ]
 [ "sqlcatalog","create_function",  "pattern 
sqlcatalog.create_function(X_1:str, X_2:str, X_3:ptr):void ",  
"SQLcreate_function;",  ""  ]
 [ "sqlcatalog","create_role",  "pattern 
sqlcatalog.create_role(X_1:str, X_2:str, X_3:int):void ",  
"SQLcreate_role;",  ""  ]
@@ -9522,7 +9522,7 @@ stdout of test 'MAL-signatures` in direc
 [ "sqlcatalog","create_table", "pattern 
sqlcatalog.create_table(X_1:str, X_2:str, X_3:ptr, X_4:int):void ",
"SQLcreate_table;", ""  ]
 [ "sqlcatalog","create_trigger",   "pattern 
sqlcatalog.create_trigger(X_1:str, X_2:str, X_3:str, X_4:int, X_5:int, X_6:int, 
X_7:str, X_8:str, X_9:str, X_10:str):void ",   "SQLcreate_trigger;",   ""  ]
 [ "sqlcatalog","create_type",  "pattern 
sqlcatalog.create_type(X_1:str, X_2:str, X_3:str):void ",  
"SQLcreate_type;",  ""  ]
-[ "sqlcatalog","create_user",  "pattern 
sqlcatalog.create_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str):void ",
"SQLcreate_user;",  ""  ]
+[ "sqlcatalog","create_user",  "pattern 
sqlcatalog.create_user(X_1:str, X_2:str, X_3:int, X_4:str, X_5:str, 
X_6:str):void ",   "SQLcreate_user;",  ""  ]
 [ "sqlcatalog","create_view",  "pattern 
sqlcatalog.create_view(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", 
"SQLcreate_view;",  ""  ]
 [ "sqlcatalog","drop_constraint",  "pattern 
sqlcatalog.drop_constraint(X_1:str, X_2:str, X_3:int, X_4:int):void ", 
"SQLdrop_constraint;",  ""  ]
 [ "sqlcatalog","drop_function","pattern 
sqlcatalog.drop_function(X_1:str, X_2:str, X_3:int, X_4:int, X_5:int):void ",  
"SQLdrop_function;",""  ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -12836,7 +12836,7 @@ stdout of test 'MAL-signatures` in direc
 [ "sqlcatalog","alter_seq","pattern sqlcatalog.alter_seq(X_1:str, 
X_2:str, X_3:ptr, X_4:lng):void ",   "SQLalter_seq;",""  ]
 [ "sqlcatalog","alter_set_table",  "pattern 
sqlcatalog.alter_set_table(X_1:str, X_2:str, X_3:int):void ",  
"SQLalter_set_table;",  ""  ]
 [ "sqlcatalog","alter_table",  "pattern 
sqlcatalog.alter_table(X_1:str, X_2:str, X_3:ptr, X_4:int):void ", 
"SQLalter_table;",  ""  ]
-[ "sqlcatalog","alter_user",   "pattern sqlcatalog.alter_user(X_1:str, 
X_2:str, X_3:int, X_4:str, X_5:str):void ", "SQLalter_user;",   ""  
]
+[ "sqlcatalog","alter_user",   "pattern sqlcatalog.alter_user(X_1:str, 
X_2:str, X_3:int, X_4:str, X_5:str, X_6:str):void ","SQLalter_user;",   
""  ]
 [ "sqlcatalog","comment_on",   "pattern sqlcatalog.comment_on(X_1:int, 
X_2:str):void ","SQLcomment_on;",   ""  ]
 [ "sqlcatalog","create_function",  "pattern 
sqlcatalog.create_function(X_1:str, X_2:str, X_3:ptr):void ",  
"SQLcreate_function;",  ""  ]
 [ "sqlcatalog","create_role",  "pattern 
sqlcatalog.create_role(X_1:str, X_2:str, X_3:int):void ",  
"SQLcreate_role;",  ""  ]
@@ -12845,7 +12845,7 @@ stdout of test 'MAL-signatures` in direc
 [ "sqlcatalog",

MonetDB: nospare - merged with default

2021-01-04 Thread Niels Nes
Changeset: f98643db9b52 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f98643db9b52
Branch: nospare
Log Message:

merged with default


diffs (truncated from 1553 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -2698,7 +2698,7 @@ sed -i 's|/var/run|/run|' \
   are equal to 1.1.  (The old code returned 33554432 instead of 1.1e8.)
 
 * Sun Nov  5 2017 Sjoerd Mullender  - 11.27.9-20171105
-- BZ#6460 - selinux doen't allow mmap
+- BZ#6460: selinux doen't allow mmap
 
 * Mon Oct 23 2017 Sjoerd Mullender  - 11.27.9-20171023
 - Rebuilt.
diff --git a/debian/changelog b/debian/changelog
--- a/debian/changelog
+++ b/debian/changelog
@@ -2469,6 +2469,12 @@ monetdb (11.27.11) unstable; urgency=low
 
 monetdb (11.27.9) unstable; urgency=low
 
+  * BZ#6460: selinux doen't allow mmap
+
+ -- Sjoerd Mullender   Sun, 5 Nov 2017 09:56:39 +0100
+
+monetdb (11.27.9) unstable; urgency=low
+
   * Rebuilt.
   * BZ#6207: identifier ambiguous when grouping and selecting the same
 column twice
diff --git a/gdk/gdk_join.c b/gdk/gdk_join.c
--- a/gdk/gdk_join.c
+++ b/gdk/gdk_join.c
@@ -2500,7 +2500,8 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
 struct canditer *restrict lci, struct canditer *restrict rci,
 bool nil_matches, bool nil_on_miss, bool semi, bool only_misses,
 bool not_in, bool max_one,
-BUN estimate, lng t0, bool swapped, bool hash, bool phash,
+BUN estimate, lng t0, bool swapped,
+bool hash, bool phash, bool hash_cand,
 const char *reason)
 {
oid lo, ro;
@@ -2519,7 +2520,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
const char *v = (const char *) 
bool lskipped = false;  /* whether we skipped values in l */
Hash *restrict hsh = NULL;
-   bool hash_cand = false;
 
assert(!BATtvoid(r));
assert(ATOMtype(l->ttype) == ATOMtype(r->ttype));
@@ -2555,7 +2555,24 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
 
rl = rci->seq - r->hseqbase;
rh = canditer_last(rci) + 1 - r->hseqbase;
-   if (phash) {
+   if (hash_cand) {
+   /* we need to create a hash on r specific for the
+* candidate list */
+   char ext[32];
+   assert(rci->s);
+   MT_thread_setalgorithm(swapped ? "hashjoin using candidate hash 
(swapped)" : "hashjoin using candidate hash");
+   TRC_DEBUG(ALGO, ALGOBATFMT ": creating "
+ "hash for candidate list " ALGOBATFMT "%s%s\n",
+ ALGOBATPAR(r), ALGOBATPAR(rci->s),
+ r->thash ? " ignoring existing hash" : "",
+ swapped ? " (swapped)" : "");
+   if (snprintf(ext, sizeof(ext), "thshjn%x",
+(unsigned) rci->s->batCacheid) >= (int) 
sizeof(ext))
+   goto bailout;
+   if ((hsh = BAThash_impl(r, rci, ext)) == NULL) {
+   goto bailout;
+   }
+   } else if (phash) {
/* there is a hash on the parent which we should use */
MT_thread_setalgorithm(swapped ? "hashjoin using parent hash 
(swapped)" : "hashjoin using parent hash");
BAT *b = BBPdescriptor(VIEWtparent(r));
@@ -2577,24 +2594,6 @@ hashjoin(BAT **r1p, BAT **r2p, BAT *l, B
  "existing hash%s\n",
  ALGOBATPAR(r),
  swapped ? " (swapped)" : "");
-   } else if (rci->tpe != cand_dense || rci->ncand != BATcount(r)) {
-   /* we need to create a hash on r specific for the
-* candidate list */
-   char ext[32];
-   assert(rci->s);
-   MT_thread_setalgorithm(swapped ? "hashjoin using candidate hash 
(swapped)" : "hashjoin using candidate hash");
-   TRC_DEBUG(ALGO, ALGOBATFMT ": creating "
- "hash for candidate list " ALGOBATFMT "%s%s\n",
- ALGOBATPAR(r), ALGOBATPAR(rci->s),
- r->thash ? " ignoring existing hash" : "",
- swapped ? " (swapped)" : "");
-   if (snprintf(ext, sizeof(ext), "thshjn%x",
-(unsigned) rci->s->batCacheid) >= (int) 
sizeof(ext))
-   goto bailout;
-   if ((hsh = BAThash_impl(r, rci, ext)) == NULL) {
-   goto bailout;
-   }
-   hash_cand = true;
} else {
/* we need to create a hash on r */
MT_thread_setalgorithm(swapped ? "hashjoin using new hash 
(swapped)" : "hashjoin using new hash");
@@ -3071,6 +3070,79 @@ guess_uniques(BAT *b, struct canditer *c
return B;
 }
 
+/* estimate the cost of doing a hashjoin with a hash on r; return value
+ * is the estimated cost, the last three arguments receive some extra
+ * information */
+static double