MonetDB: groupjoin - merged

2023-08-31 Thread Niels Nes via checkin-list
Changeset: 767313d5c6b6 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/767313d5c6b6
Branch: groupjoin
Log Message:

merged


diffs (33 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -1754,7 +1754,6 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions", "sys",  "evalalgebra",  "SYSTEM",   "create 
procedure sys.evalalgebra(ra_stmt string, opt bool) external name 
sql.\"evalAlgebra\";","sql",  "MAL",  "Procedure",true,   false,  
false,  true,   NULL,   "ra_stmt",  "clob", 0,  0,  "in",   "opt",  
"boolean",  1,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","double",   53, 0,  "out",  "arg_1",
"double",   53, 0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","real", 24, 0,  "out",  "arg_1","real", 24, 
0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL]
-[ "sys.functions", "sys",  "file_loader",  "SYSTEM",   "", "", 
"Internal C",   "Function returning a table",   false,  true,   false,  true,   
NULL,   "res_0","table",0,  0,  "out",  "arg_1",
"clob", 0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "first_value",  "SYSTEM",   "first_value",  
"sql",  "Internal C",   "Analytic function",false,  false,  false,  true,   
NULL,   "res_0","any",  0,  0,  "out",  "arg_1","any",  
0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "fitsattach",   "SYSTEM",   "create 
procedure fitsattach(fname string) external name fits.attach;", "fits", "MAL",  
"Procedure",true,   false,  false,  true,   NULL,   "fname","clob", 
0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   

MonetDB: default - approved output

2023-08-31 Thread Niels Nes via checkin-list
Changeset: 1255c196a201 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/1255c196a201
Modified Files:
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: default
Log Message:

approved output


diffs (33 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -1754,7 +1754,6 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions", "sys",  "evalalgebra",  "SYSTEM",   "create 
procedure sys.evalalgebra(ra_stmt string, opt bool) external name 
sql.\"evalAlgebra\";","sql",  "MAL",  "Procedure",true,   false,  
false,  true,   NULL,   "ra_stmt",  "clob", 0,  0,  "in",   "opt",  
"boolean",  1,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","double",   53, 0,  "out",  "arg_1",
"double",   53, 0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","real", 24, 0,  "out",  "arg_1","real", 24, 
0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL]
-[ "sys.functions", "sys",  "file_loader",  "SYSTEM",   "", "", 
"Internal C",   "Function returning a table",   false,  true,   false,  true,   
NULL,   "res_0","table",0,  0,  "out",  "arg_1",
"clob", 0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "first_value",  "SYSTEM",   "first_value",  
"sql",  "Internal C",   "Analytic function",false,  false,  false,  true,   
NULL,   "res_0","any",  0,  0,  "out",  "arg_1","any",  
0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "fitsattach",   "SYSTEM",   "create 
procedure fitsattach(fname string) external name fits.attach;", "fits", "MAL",  

MonetDB: groupjoin - merged with default

2023-08-31 Thread Niels Nes via checkin-list
Changeset: 458c50c2e948 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/458c50c2e948
Branch: groupjoin
Log Message:

merged with default


diffs (96 lines):

diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1540,7 +1540,7 @@ sqltypeinit( sql_allocator *sa)
f->varres = 1;
 
/* file_loader */
-   f = sql_create_union(sa, "file_loader", "files", "", FALSE, SCALE_FIX, 
0, TABLE, 1, STR);
+   f = sql_create_union(sa, "file_loader", "", "", TRUE, SCALE_FIX, 0, 
TABLE, 1, STR);
f->varres = 1;
 
/* sys_update_schemas, sys_update_tables */
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
@@ -539,11 +539,15 @@ file_loader_add_table_column_types(mvc *
return "Filename missing";
 
char *ext = strrchr(filename, '.'), *ep = ext;
+
if (ext) {
ext=ext+1;
ext = mkLower(sa_strdup(sql->sa, ext));
}
 
+   if (!ext)
+   return "extension missing";
+
file_loader_t *fl = fl_find(ext);
if (!fl) {
/* maybe compressed */
@@ -567,7 +571,7 @@ file_loader_add_table_column_types(mvc *
sql_subtype *st = sql_bind_localtype("str");
sql_exp *ext_exp = exp_atom(sql->sa, atom_string(sql->sa, st, ext));
if (!ext_exp)
-   return sql_error(sql, 02, SQLSTATE(HY013) MAL_MALLOC_FAIL);
+   return MAL_MALLOC_FAIL;
append(exps, ext_exp);
return NULL;
 }
@@ -578,7 +582,7 @@ rel_file_loader(mvc *sql, list *exps, li
sql_subfunc *f = NULL;
bool found = false;
 
-   if ((f = bind_func_(sql, NULL, "file_loader", tl, F_UNION, false, 
))) {
+   if ((f = bind_func_(sql, NULL, "file_loader", tl, F_UNION, true, 
))) {
list *nexps = exps;
if (list_empty(tl) || f->func->vararg || (nexps = 
check_arguments_and_find_largest_any_type(sql, NULL, exps, f, 1))) {
list *res_exps = sa_list(sql->sa);
diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -1754,7 +1754,7 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions", "sys",  "evalalgebra",  "SYSTEM",   "create 
procedure sys.evalalgebra(ra_stmt string, opt bool) external name 
sql.\"evalAlgebra\";","sql",  "MAL",  "Procedure",true,   false,  
false,  true,   NULL,   "ra_stmt",  "clob", 0,  0,  "in",   "opt",  
"boolean",  1,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","double",   53, 0,  "out",  "arg_1",
"double",   53, 0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","real", 24, 0,  "out",  "arg_1","real", 24, 
0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL]
-[ "sys.functions", "sys",  

MonetDB: default - approved output

2023-08-31 Thread Niels Nes via checkin-list
Changeset: 35125ae7f6ee for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/35125ae7f6ee
Modified Files:
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: default
Log Message:

approved output


diffs (36 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -1754,7 +1754,7 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions", "sys",  "evalalgebra",  "SYSTEM",   "create 
procedure sys.evalalgebra(ra_stmt string, opt bool) external name 
sql.\"evalAlgebra\";","sql",  "MAL",  "Procedure",true,   false,  
false,  true,   NULL,   "ra_stmt",  "clob", 0,  0,  "in",   "opt",  
"boolean",  1,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","double",   53, 0,  "out",  "arg_1",
"double",   53, 0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","real", 24, 0,  "out",  "arg_1","real", 24, 
0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL]
-[ "sys.functions", "sys",  "file_loader",  "SYSTEM",   "", 
"files","Internal C",   "Function returning a table",   false,  true,   
false,  true,   NULL,   "res_0","table",0,  0,  "out",  
"arg_1","clob", 0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL]
+[ "sys.functions", "sys",  "file_loader",  "SYSTEM",   "", "", 
"Internal C",   "Function returning a table",   false,  true,   false,  true,   
NULL,   "res_0","table",0,  0,  "out",  "arg_1",
"clob", 0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "first_value",  "SYSTEM",   "first_value",  
"sql",  "Internal C",   "Analytic function",false,  

MonetDB: default - functions with both mod/imp set to "" are spe...

2023-08-31 Thread Niels Nes via checkin-list
Changeset: e202778b9a2e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/e202778b9a2e
Modified Files:
sql/common/sql_types.c
Branch: default
Log Message:

functions with both mod/imp set to "" are special, that also holds for the 
file_loader.


diffs (12 lines):

diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1540,7 +1540,7 @@ sqltypeinit( sql_allocator *sa)
f->varres = 1;
 
/* file_loader */
-   f = sql_create_union(sa, "file_loader", "files", "", FALSE, SCALE_FIX, 
0, TABLE, 1, STR);
+   f = sql_create_union(sa, "file_loader", "", "", FALSE, SCALE_FIX, 0, 
TABLE, 1, STR);
f->varres = 1;
 
/* sys_update_schemas, sys_update_tables */
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: groupjoin - merged with default

2023-08-31 Thread Niels Nes via checkin-list
Changeset: 0a2fd9926975 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0a2fd9926975
Modified Files:
sql/backends/monet5/rel_bin.c
sql/server/rel_exp.c
Branch: groupjoin
Log Message:

merged with default


diffs (truncated from 775 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
@@ -190,7 +190,7 @@ list_find_column(backend *be, list *l, c
const char *nme = column_name(be->mvc->sa, s);
 
if (rnme && strcmp(rnme, rname) == 0 &&
-   strcmp(nme, name) == 0) {
+   strcmp(nme, name) == 0) {
res = s;
break;
}
@@ -601,7 +601,7 @@ exp_count_no_nil_arg(sql_exp *e, stmt *e
while (as->type == st_alias)
as = as->op1;
/* use candidate */
-   if (as && as->type == st_join && as->flag == cmp_project) {
+   if (as && as->type == st_join && as->flag == cmp_project) {
if (as->op1 && (as->op1->type != st_result || 
as->op1->op1->type != st_group)) /* exclude a subquery with select distinct 
under the count */
as = as->op1;
}
@@ -911,7 +911,7 @@ exp2bin_casewhen(backend *be, sql_exp *f
stmt *case_when = exp_bin(be, e, left, right, NULL, NULL, NULL, nsel, 
depth+1, 0, 1);
if (!case_when)
return NULL;
-   cmp = sql_bind_func(be->mvc, "sys", "=", exp_subtype(e), 
exp_subtype(e), F_FUNC, true);
+   cmp = sql_bind_func(be->mvc, "sys", "=", exp_subtype(e), 
exp_subtype(e), F_FUNC, true);
if (!cmp)
return NULL;
if (!single_value && !case_when->nrcols) {
@@ -1378,7 +1378,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
mvc *sql = be->mvc;
stmt *s = NULL;
 
-   if (mvc_highwater(sql))
+   if (mvc_highwater(sql))
return sql_error(be->mvc, 10, SQLSTATE(42000) "Query too 
complex: running out of stack space");
 
if (!e) {
@@ -1429,7 +1429,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
return stmt_return(be, r, GET_PSM_LEVEL(e->flag));
} else if (e->flag & PSM_WHILE) {
/* while is a if - block true with leave statement
-* needed because the condition needs to be inside this 
outer block */
+* needed because the condition needs to be inside this 
outer block */
stmt *ifstmt = stmt_cond(be, stmt_bool(be, 1), NULL, 0, 
0);
stmt *cond = exp_bin(be, e->l, left, right, grp, ext, 
cnt, sel, 0, 0, push);
stmt *wstmt;
@@ -1479,15 +1479,15 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
break;
case e_atom: {
-   if (e->l) { /* literals */
+   if (e->l) { /* literals */
s = stmt_atom(be, e->l);
-   } else if (e->r) {  /* parameters and declared 
variables */
+   } else if (e->r) {  /* parameters and declared 
variables */
sql_var_name *vname = (sql_var_name*) e->r;
assert(vname->name);
s = stmt_var(be, vname->sname ? sa_strdup(sql->sa, 
vname->sname) : NULL, sa_strdup(sql->sa, vname->name), 
e->tpe.type?>tpe:NULL, 0, e->flag);
-   } else if (e->f) {  /* values */
+   } else if (e->f) {  /* values */
s = value_list(be, e->f, left, sel);
-   } else {/* arguments */
+   } else {/* arguments */
sql_subtype *t = e->tpe.type?>tpe:NULL;
if (!t && 0) {
sql_arg *a = sql_bind_paramnr(be->mvc, e->flag);
@@ -1513,7 +1513,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
if (!l)
return NULL;
s = stmt_convert(be, l, (!push&>nrcols==0)?NULL:sel, from, 
to);
-   }   break;
+   }   break;
case e_func: {
node *en;
list *l = sa_list(sql->sa), *exps = e->l;
@@ -1581,7 +1581,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
if (!(s = stmt_Nop(be, stmt_list(be, l), sel, f, rows)))
return NULL;
-   }   break;
+   }   break;
case e_aggr: {
list *attr = e->l;
stmt *as = NULL;
@@ -1658,7 +1658,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
s = stmt_aggr(be, as, 

MonetDB: default - Removed the end of query ; characters

2023-08-31 Thread Martin van Dinther via checkin-list
Changeset: 443bf66b1cfb for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/443bf66b1cfb
Modified Files:
sql/test/file_loader/Tests/file_loader_function.test
sql/test/file_loader/Tests/file_loader_string.test
Branch: default
Log Message:

Removed the end of query ; characters


diffs (49 lines):

diff --git a/sql/test/file_loader/Tests/file_loader_function.test 
b/sql/test/file_loader/Tests/file_loader_function.test
--- a/sql/test/file_loader/Tests/file_loader_function.test
+++ b/sql/test/file_loader/Tests/file_loader_function.test
@@ -1,16 +1,16 @@
 query TT rowsort
-select name, mod from sys.functions where mod is null or mod = '';
+select name, mod from sys.functions where mod is null or mod = ''
 
 
 statement error 42000!Table expression without table name
-select * from file_loader('');
+select * from file_loader('')
 
 statement error 42000!Table expression without table name
-select * from file_loader('filenotfound');
+select * from file_loader('filenotfound')
 
 statement error server crash
-select * from sys.file_loader('');
+select * from sys.file_loader('')
 
 statement error server crash
-select * from sys.file_loader('filenotfound');
+select * from sys.file_loader('filenotfound')
 
diff --git a/sql/test/file_loader/Tests/file_loader_string.test 
b/sql/test/file_loader/Tests/file_loader_string.test
--- a/sql/test/file_loader/Tests/file_loader_string.test
+++ b/sql/test/file_loader/Tests/file_loader_string.test
@@ -1,15 +1,15 @@
 statement error 42000!Table expression without table name
-select * from '';
+select * from ''
 
 statement error 42000!Table expression without table name
-select * from 'FileNotFound';
+select * from 'FileNotFound'
 
 statement error 42000!Table expression without table name
-select * from '/tmp/FileNotFound';
+select * from '/tmp/FileNotFound'
 
 statement error 42000!Table expression without table name
-select * from '/tmp/FileNotFound.csv';
+select * from '/tmp/FileNotFound.csv'
 
 statement error 42000!Table expression without table name
-select * from '/tmp/FileNotFound.csv.gz';
+select * from '/tmp/FileNotFound.csv.gz'
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Add test for new syntax: FROM 'filename'. The...

2023-08-31 Thread Martin van Dinther via checkin-list
Changeset: f816c1775f8f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f816c1775f8f
Added Files:
sql/test/file_loader/Tests/SingleServer
sql/test/file_loader/Tests/file_loader_string.test
Modified Files:
sql/test/file_loader/Tests/All
Branch: default
Log Message:

Add test for new syntax: FROM 'filename'. The parser accepts this notation but 
calls file_loader().


diffs (28 lines):

diff --git a/sql/test/file_loader/Tests/All b/sql/test/file_loader/Tests/All
--- a/sql/test/file_loader/Tests/All
+++ b/sql/test/file_loader/Tests/All
@@ -1,1 +1,2 @@
 file_loader_function
+file_loader_string
diff --git a/sql/test/file_loader/Tests/SingleServer 
b/sql/test/file_loader/Tests/SingleServer
new file mode 100644
diff --git a/sql/test/file_loader/Tests/file_loader_string.test 
b/sql/test/file_loader/Tests/file_loader_string.test
new file mode 100644
--- /dev/null
+++ b/sql/test/file_loader/Tests/file_loader_string.test
@@ -0,0 +1,15 @@
+statement error 42000!Table expression without table name
+select * from '';
+
+statement error 42000!Table expression without table name
+select * from 'FileNotFound';
+
+statement error 42000!Table expression without table name
+select * from '/tmp/FileNotFound';
+
+statement error 42000!Table expression without table name
+select * from '/tmp/FileNotFound.csv';
+
+statement error 42000!Table expression without table name
+select * from '/tmp/FileNotFound.csv.gz';
+
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Added missing copyright header to sql/backend...

2023-08-31 Thread Martin van Dinther via checkin-list
Changeset: d75702856187 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d75702856187
Modified Files:
sql/backends/monet5/rel_bin.c
sql/backends/monet5/vaults/csv/csv.c
sql/server/rel_exp.c
sql/server/rel_optimize_others.c
sql/server/rel_select.c
sql/server/sql_parser.y
Branch: default
Log Message:

Added missing copyright header to sql/backends/monet5/vaults/csv/csv.c
Removed leading space characters where not needed or trailing space or tab 
characters.
Corrected indentations.


diffs (truncated from 722 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
@@ -190,7 +190,7 @@ list_find_column(backend *be, list *l, c
const char *nme = column_name(be->mvc->sa, s);
 
if (rnme && strcmp(rnme, rname) == 0 &&
-   strcmp(nme, name) == 0) {
+   strcmp(nme, name) == 0) {
res = s;
break;
}
@@ -601,7 +601,7 @@ exp_count_no_nil_arg(sql_exp *e, stmt *e
while (as->type == st_alias)
as = as->op1;
/* use candidate */
-   if (as && as->type == st_join && as->flag == cmp_project) {
+   if (as && as->type == st_join && as->flag == cmp_project) {
if (as->op1 && (as->op1->type != st_result || 
as->op1->op1->type != st_group)) /* exclude a subquery with select distinct 
under the count */
as = as->op1;
}
@@ -890,7 +890,7 @@ exp2bin_casewhen(backend *be, sql_exp *f
stmt *case_when = exp_bin(be, e, left, right, NULL, NULL, NULL, nsel, 
depth+1, 0, 1);
if (!case_when)
return NULL;
-   cmp = sql_bind_func(be->mvc, "sys", "=", exp_subtype(e), 
exp_subtype(e), F_FUNC, true);
+   cmp = sql_bind_func(be->mvc, "sys", "=", exp_subtype(e), 
exp_subtype(e), F_FUNC, true);
if (!cmp)
return NULL;
if (!single_value && !case_when->nrcols) {
@@ -1357,7 +1357,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
mvc *sql = be->mvc;
stmt *s = NULL;
 
-   if (mvc_highwater(sql))
+   if (mvc_highwater(sql))
return sql_error(be->mvc, 10, SQLSTATE(42000) "Query too 
complex: running out of stack space");
 
if (!e) {
@@ -1408,7 +1408,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
return stmt_return(be, r, GET_PSM_LEVEL(e->flag));
} else if (e->flag & PSM_WHILE) {
/* while is a if - block true with leave statement
-* needed because the condition needs to be inside this 
outer block */
+* needed because the condition needs to be inside this 
outer block */
stmt *ifstmt = stmt_cond(be, stmt_bool(be, 1), NULL, 0, 
0);
stmt *cond = exp_bin(be, e->l, left, right, grp, ext, 
cnt, sel, 0, 0, push);
stmt *wstmt;
@@ -1458,15 +1458,15 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
break;
case e_atom: {
-   if (e->l) { /* literals */
+   if (e->l) { /* literals */
s = stmt_atom(be, e->l);
-   } else if (e->r) {  /* parameters and declared 
variables */
+   } else if (e->r) {  /* parameters and declared 
variables */
sql_var_name *vname = (sql_var_name*) e->r;
assert(vname->name);
s = stmt_var(be, vname->sname ? sa_strdup(sql->sa, 
vname->sname) : NULL, sa_strdup(sql->sa, vname->name), 
e->tpe.type?>tpe:NULL, 0, e->flag);
-   } else if (e->f) {  /* values */
+   } else if (e->f) {  /* values */
s = value_list(be, e->f, left, sel);
-   } else {/* arguments */
+   } else {/* arguments */
sql_subtype *t = e->tpe.type?>tpe:NULL;
if (!t && 0) {
sql_arg *a = sql_bind_paramnr(be->mvc, e->flag);
@@ -1492,7 +1492,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
if (!l)
return NULL;
s = stmt_convert(be, l, (!push&>nrcols==0)?NULL:sel, from, 
to);
-   }   break;
+   }   break;
case e_func: {
node *en;
list *l = sa_list(sql->sa), *exps = e->l;
@@ -1560,7 +1560,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
if (!(s = stmt_Nop(be, 

MonetDB: groupjoin - merged with default

2023-08-31 Thread Niels Nes via checkin-list
Changeset: aad47eed5d12 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/aad47eed5d12
Branch: groupjoin
Log Message:

merged with default


diffs (283 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -673,9 +673,9 @@ SQLhelp sqlhelp2[] = {
 NULL},
{"generated_column",
 NULL,
-"AUTO_INCREMENT | GENERATED ALWAYS AS IDENTITY [ '(' [ AS data_type] [ 
START [WITH start]] [INCREMENT BY increment]\n"
-"[MINVALUE minvalue | NO MINVALUE] [MAXVALUE maxvalue | NO MAXVALUE] 
[CACHE cachevalue] [[NO] CYCLE] ')' ] ",
-"data_type",
+"AUTO_INCREMENT | GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ '(' 
[ AS seq_int_datatype] [ START [WITH start]]\n"
+" [INCREMENT BY increment] [MINVALUE minvalue | NO MINVALUE] [MAXVALUE 
maxvalue | NO MAXVALUE] [CACHE cachevalue] [[NO] CYCLE] ')' ]",
+"seq_int_datatype",
 "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-types/serial-types/"},
{"global_privileges",
 NULL,
diff --git a/sql/ChangeLog b/sql/ChangeLog
--- a/sql/ChangeLog
+++ b/sql/ChangeLog
@@ -16,6 +16,12 @@
   Note: MonetDB does NOT support catalog qualifiers in object names, so all the
   _CATALOG columns in these information_schema views will allways contain NULL.
 
+* Mon Aug 21 2023 Niels Nes 
+- Added support for generated column syntax:
+   GENERATED BY DEFAULT AS IDENTITY ...
+  This allows the user to override the default generated sequence value
+  during inserts.
+
 * Fri Jul 7 2023 Niels Nes 
 - Added SQL support for:  and 
   in   ::=
diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1540,7 +1540,7 @@ sqltypeinit( sql_allocator *sa)
f->varres = 1;
 
/* file_loader */
-   f = sql_create_union(sa, "file_loader", "", "", FALSE, SCALE_FIX, 0, 
TABLE, 1, STR);
+   f = sql_create_union(sa, "file_loader", "files", "", FALSE, SCALE_FIX, 
0, TABLE, 1, STR);
f->varres = 1;
 
/* sys_update_schemas, sys_update_tables */
diff --git a/sql/server/rel_file_loader.c b/sql/server/rel_file_loader.c
--- a/sql/server/rel_file_loader.c
+++ b/sql/server/rel_file_loader.c
@@ -1,3 +1,12 @@
+/*
+ * SPDX-License-Identifier: MPL-2.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 - 2023 MonetDB B.V.
+ */
 
 #include "monetdb_config.h"
 #include "rel_file_loader.h"
@@ -8,7 +17,7 @@ static file_loader_t file_loaders[NR_FIL
 void
 fl_exit(void)
 {
-   for (int i = 0; iname);
-   fl->name = NULL;
+   GDKfree(fl->name);
+   fl->name = NULL;
}
 }
 
@@ -29,13 +37,13 @@ int
 fl_register(char *name, fl_add_types_fptr add_types, fl_load_fptr load)
 {
file_loader_t *fl = fl_find(name);
-
if (fl) {
printf("re-registering %s\n", name);
GDKfree(fl->name);
fl->name = NULL;
}
-   for (int i = 0; ih->data;
if (!exp_is_atom(file))
return "Filename missing";
+
atom *a = file->l;
if (a->data.vtype != TYPE_str || !a->data.val.sval)
return "Filename missing";
+
char *filename = a->data.val.sval;
+   if (strcmp(filename, "") == 0)
+   return "Filename missing";
+
char *ext = strrchr(filename, '.'), *ep = ext;
-
if (ext) {
ext=ext+1;
ext = mkLower(sa_strdup(sql->sa, ext));
@@ -563,7 +567,7 @@ file_loader_add_table_column_types(mvc *
sql_subtype *st = sql_bind_localtype("str");
sql_exp *ext_exp = exp_atom(sql->sa, atom_string(sql->sa, st, ext));
if (!ext_exp)
-   return sql_error(sql, 02, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
+   return sql_error(sql, 02, SQLSTATE(HY013) MAL_MALLOC_FAIL);
append(exps, ext_exp);
return NULL;
 }
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -1906,6 +1906,7 @@ column_def:
}
  |  column serial_or_bigserial
{ /* SERIAL = INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY 
*/
+ /* BIGSERIAL = BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY 
KEY */
/* handle multi-statements by wrapping them in a list */
sql_subtype it;
dlist* stmts;
diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -1754,7 +1754,7 @@ select 'null in fkeys.delete_action', de

MonetDB: groupjoin - enable some more expression rewriting on le...

2023-08-31 Thread Niels Nes via checkin-list
Changeset: 188c793f2e0e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/188c793f2e0e
Modified Files:
sql/server/rel_exp.c
sql/server/rel_rewriter.c
Branch: groupjoin
Log Message:

enable some more expression rewriting on left outer group joins


diffs (23 lines):

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
@@ -1832,6 +1832,7 @@ exp_regular_cmp_exp_is_false(sql_exp* e)
 assert(e->type == e_cmp);
 
 if (is_semantics(e) && !is_any(e)) return exp_is_cmp_exp_is_false(e);
+   if (is_any(e)) return false;
 if (e -> f) return exp_two_sided_bound_cmp_exp_is_false(e);
 elsereturn exp_single_bound_cmp_exp_is_false(e);
 }
diff --git a/sql/server/rel_rewriter.c b/sql/server/rel_rewriter.c
--- a/sql/server/rel_rewriter.c
+++ b/sql/server/rel_rewriter.c
@@ -205,7 +205,7 @@ rewrite_simplify(visitor *v, uint8_t cyc
 
if ((is_select(rel->op) || is_join(rel->op) || is_semi(rel->op)) && 
!list_empty(rel->exps)) {
int changes = v->changes;
-   rel->exps = list_empty(rel->attr)?exps_simplify_exp(v, 
rel->exps):rel->exps;
+   rel->exps = exps_simplify_exp(v, rel->exps);
/* At a select or inner join relation if the single expression 
is false, eliminate the inner relations with a dummy projection */
if (value_based_opt && (v->changes > changes || cycle == 0) && 
(is_select(rel->op) || is_innerjoin(rel->op)) &&
!is_single(rel) && list_length(rel->exps) == 1 && 
(exp_is_false(rel->exps->h->data) || exp_is_null(rel->exps->h->data))) {
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Approve updated file_loader function info

2023-08-31 Thread Martin van Dinther via checkin-list
Changeset: 6734c9d6db44 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6734c9d6db44
Modified Files:
sql/test/emptydb/Tests/check.stable.out
sql/test/emptydb/Tests/check.stable.out.32bit
sql/test/emptydb/Tests/check.stable.out.int128
Branch: default
Log Message:

Approve updated file_loader function info


diffs (36 lines):

diff --git a/sql/test/emptydb/Tests/check.stable.out 
b/sql/test/emptydb/Tests/check.stable.out
--- a/sql/test/emptydb/Tests/check.stable.out
+++ b/sql/test/emptydb/Tests/check.stable.out
@@ -1754,7 +1754,7 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions", "sys",  "evalalgebra",  "SYSTEM",   "create 
procedure sys.evalalgebra(ra_stmt string, opt bool) external name 
sql.\"evalAlgebra\";","sql",  "MAL",  "Procedure",true,   false,  
false,  true,   NULL,   "ra_stmt",  "clob", 0,  0,  "in",   "opt",  
"boolean",  1,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","double",   53, 0,  "out",  "arg_1",
"double",   53, 0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "exp",  "SYSTEM",   "exp",  "mmath",
"Internal C",   "Scalar function",  false,  false,  false,  false,  NULL,   
"res_0","real", 24, 0,  "out",  "arg_1","real", 24, 
0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL]
-[ "sys.functions", "sys",  "file_loader",  "SYSTEM",   "", "", 
"Internal C",   "Function returning a table",   false,  true,   false,  true,   
NULL,   "res_0","table",0,  0,  "out",  "arg_1",
"clob", 0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL]
+[ "sys.functions", "sys",  "file_loader",  "SYSTEM",   "", 
"files","Internal C",   "Function returning a table",   false,  true,   
false,  true,   NULL,   "res_0","table",0,  0,  "out",  
"arg_1","clob", 0,  0,  "in",   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL]
 [ "sys.functions", "sys",  "first_value",  "SYSTEM",   "first_value",  
"sql",  "Internal C",   

MonetDB: default - Added missing module name "files" to new syst...

2023-08-31 Thread Martin van Dinther via checkin-list
Changeset: f3ca6fa4f188 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/f3ca6fa4f188
Added Files:
sql/test/file_loader/Tests/All
sql/test/file_loader/Tests/file_loader_function.test
Modified Files:
sql/common/sql_types.c
sql/server/rel_file_loader.c
sql/server/rel_select.c
Branch: default
Log Message:

Added missing module name "files" to new system function: file_loader(str 
filename).
For all sys.functions the mod column should have a none empty value. It didn't 
for file_loader()

Add tests for calling new system function: file_loader(str filename) which 
returns a table.
The test crashes the server (sql/server/rel_exp.c:697: exp_column: Assertion 
`cname' failed.)

Added extra check on empty file name in file_loader_add_table_column_types().
This is apparently not enough to solve the server crash.
More fixes are needed, e.g. in rel_named_table_function().


diffs (143 lines):

diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c
--- a/sql/common/sql_types.c
+++ b/sql/common/sql_types.c
@@ -1540,7 +1540,7 @@ sqltypeinit( sql_allocator *sa)
f->varres = 1;
 
/* file_loader */
-   f = sql_create_union(sa, "file_loader", "", "", FALSE, SCALE_FIX, 0, 
TABLE, 1, STR);
+   f = sql_create_union(sa, "file_loader", "files", "", FALSE, SCALE_FIX, 
0, TABLE, 1, STR);
f->varres = 1;
 
/* sys_update_schemas, sys_update_tables */
diff --git a/sql/server/rel_file_loader.c b/sql/server/rel_file_loader.c
--- a/sql/server/rel_file_loader.c
+++ b/sql/server/rel_file_loader.c
@@ -1,3 +1,12 @@
+/*
+ * SPDX-License-Identifier: MPL-2.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 - 2023 MonetDB B.V.
+ */
 
 #include "monetdb_config.h"
 #include "rel_file_loader.h"
@@ -8,7 +17,7 @@ static file_loader_t file_loaders[NR_FIL
 void
 fl_exit(void)
 {
-   for (int i = 0; iname);
-   fl->name = NULL;
+   GDKfree(fl->name);
+   fl->name = NULL;
}
 }
 
@@ -29,13 +37,13 @@ int
 fl_register(char *name, fl_add_types_fptr add_types, fl_load_fptr load)
 {
file_loader_t *fl = fl_find(name);
-
if (fl) {
printf("re-registering %s\n", name);
GDKfree(fl->name);
fl->name = NULL;
}
-   for (int i = 0; ih->data;
if (!exp_is_atom(file))
return "Filename missing";
+
atom *a = file->l;
if (a->data.vtype != TYPE_str || !a->data.val.sval)
return "Filename missing";
+
char *filename = a->data.val.sval;
+   if (strcmp(filename, "") == 0)
+   return "Filename missing";
+
char *ext = strrchr(filename, '.'), *ep = ext;
-
if (ext) {
ext=ext+1;
ext = mkLower(sa_strdup(sql->sa, ext));
@@ -563,7 +567,7 @@ file_loader_add_table_column_types(mvc *
sql_subtype *st = sql_bind_localtype("str");
sql_exp *ext_exp = exp_atom(sql->sa, atom_string(sql->sa, st, ext));
if (!ext_exp)
-   return sql_error(sql, 02, SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
+   return sql_error(sql, 02, SQLSTATE(HY013) MAL_MALLOC_FAIL);
append(exps, ext_exp);
return NULL;
 }
diff --git a/sql/test/file_loader/Tests/All b/sql/test/file_loader/Tests/All
new file mode 100644
--- /dev/null
+++ b/sql/test/file_loader/Tests/All
@@ -0,0 +1,1 @@
+file_loader_function
diff --git a/sql/test/file_loader/Tests/file_loader_function.test 
b/sql/test/file_loader/Tests/file_loader_function.test
new file mode 100644
--- /dev/null
+++ b/sql/test/file_loader/Tests/file_loader_function.test
@@ -0,0 +1,16 @@
+query TT rowsort
+select name, mod from sys.functions where mod is null or mod = '';
+
+
+statement error 42000!Table expression without table name
+select * from file_loader('');
+
+statement error 42000!Table expression without table name
+select * from file_loader('filenotfound');
+
+statement error server crash
+select * from sys.file_loader('');
+
+statement error server crash
+select * from sys.file_loader('filenotfound');
+
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: use_min_max_prop - Closing branch use_min_max_prop.

2023-08-31 Thread Sjoerd Mullender via checkin-list
Changeset: c3379072fe3f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c3379072fe3f
Branch: use_min_max_prop
Log Message:

Closing branch use_min_max_prop.

___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - only set query context if we have a client

2023-08-31 Thread Niels Nes via checkin-list
Changeset: 94029ec04f3b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/94029ec04f3b
Modified Files:
tools/monetdbe/monetdbe.c
Branch: default
Log Message:

only set query context if we have a client


diffs (61 lines):

diff --git a/tools/monetdbe/monetdbe.c b/tools/monetdbe/monetdbe.c
--- a/tools/monetdbe/monetdbe.c
+++ b/tools/monetdbe/monetdbe.c
@@ -219,6 +219,7 @@ validate_database_handle_noerror(monetdb
 {
if (!monetdbe_embedded_initialized || !MCvalid(mdbe->c))
return 0;
+   assert(mdbe->c);
MT_thread_set_qry_ctx(>c->qryctx);
clear_error(mdbe);
return 1;
@@ -953,7 +954,8 @@ monetdbe_close(monetdbe_database dbhdl)
int err = 0;
int registered_thread = mdbe->registered_thread;
 
-   MT_thread_set_qry_ctx(>c->qryctx);
+   if (mdbe->c)
+   MT_thread_set_qry_ctx(>c->qryctx);
MT_lock_set(_lock);
if (mdbe->mid)
err = monetdbe_close_remote(mdbe);
@@ -1561,6 +1563,7 @@ monetdbe_query(monetdbe_database dbhdl, 
return NULL;
monetdbe_database_internal *mdbe = (monetdbe_database_internal*)dbhdl;
 
+   assert(mdbe->c);
MT_thread_set_qry_ctx(>c->qryctx);
if (mdbe->mid) {
mdbe->msg = monetdbe_query_remote(mdbe, query, result, 
affected_rows, NULL);
@@ -1581,6 +1584,7 @@ monetdbe_prepare(monetdbe_database dbhdl
 
int prepare_id = 0;
 
+   assert(mdbe->c);
MT_thread_set_qry_ctx(>c->qryctx);
if (!stmt) {
set_error(mdbe, createException(MAL, 
"monetdbe.monetdbe_prepare", "Parameter stmt is NULL"));
@@ -1709,6 +1713,7 @@ monetdbe_execute(monetdbe_statement *stm
cq *q = stmt_internal->q;
Symbol s = NULL;
 
+   assert(mdbe->c);
MT_thread_set_qry_ctx(>c->qryctx);
if ((mdbe->msg = SQLtrans(m)) != MAL_SUCCEED)
return mdbe->msg;
@@ -1752,6 +1757,7 @@ monetdbe_cleanup_statement(monetdbe_data
 
assert(!stmt_internal->mdbe || mdbe == stmt_internal->mdbe);
 
+   assert(mdbe->c);
MT_thread_set_qry_ctx(>c->qryctx);
for (size_t i = 0; i < stmt_internal->res.nparam + 1; i++) {
ValPtr data = _internal->data[i];
@@ -1774,6 +1780,7 @@ monetdbe_cleanup_result(monetdbe_databas
monetdbe_database_internal *mdbe = (monetdbe_database_internal*)dbhdl;
monetdbe_result_internal* res = (monetdbe_result_internal *) result;
 
+   assert(mdbe->c);
MT_thread_set_qry_ctx(>c->qryctx);
if (!result) {
set_error(mdbe, createException(MAL, 
"monetdbe.monetdbe_cleanup_result_internal", "Parameter result is NULL"));
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: Jun2023 - Updated documentation.

2023-08-31 Thread Sjoerd Mullender via checkin-list
Changeset: 328d38218a64 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/328d38218a64
Modified Files:
debian/monetdb5-sql.README.Debian
Branch: Jun2023
Log Message:

Updated documentation.


diffs (33 lines):

diff --git a/debian/monetdb5-sql.README.Debian 
b/debian/monetdb5-sql.README.Debian
--- a/debian/monetdb5-sql.README.Debian
+++ b/debian/monetdb5-sql.README.Debian
@@ -2,7 +2,16 @@
 Usage
 =
 
-There are multiple ways to use MonetDB5-sql, but this is the most Debianic.
+There are multiple ways to use MonetDB5-sql.
+
+The modern way is to do:
+
+ * Enable and start MonetDB in one go::
+
+   $ sudo systemctl enable --now monetdbd.service
+
+This is the old way using System V init scripts, incompatible with the
+above:
 
  * Set STARTUP to "yes" in /etc/default/monetdb5-sql
 
@@ -10,7 +19,10 @@ There are multiple ways to use MonetDB5-
  
$ sudo /etc/init.d/monetdb5-sql start
 
- * Add yourself to the "monetdb" group::
+In either case, do this:
+
+ * Add yourself to the "monetdb" group (after this, logout and back in
+   for this to take effect)::
 
$ sudo addgroup `whoami` monetdb
 
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Update mhelp and sql/ChangeLog with new BY DE...

2023-08-31 Thread Martin van Dinther via checkin-list
Changeset: 129fa2a238d0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/129fa2a238d0
Modified Files:
clients/mapiclient/mhelp.c
sql/ChangeLog
sql/server/sql_parser.y
Branch: default
Log Message:

Update mhelp and sql/ChangeLog with new BY DEFAULT option.


diffs (43 lines):

diff --git a/clients/mapiclient/mhelp.c b/clients/mapiclient/mhelp.c
--- a/clients/mapiclient/mhelp.c
+++ b/clients/mapiclient/mhelp.c
@@ -673,9 +673,9 @@ SQLhelp sqlhelp2[] = {
 NULL},
{"generated_column",
 NULL,
-"AUTO_INCREMENT | GENERATED ALWAYS AS IDENTITY [ '(' [ AS data_type] [ 
START [WITH start]] [INCREMENT BY increment]\n"
-"[MINVALUE minvalue | NO MINVALUE] [MAXVALUE maxvalue | NO MAXVALUE] 
[CACHE cachevalue] [[NO] CYCLE] ')' ] ",
-"data_type",
+"AUTO_INCREMENT | GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ '(' 
[ AS seq_int_datatype] [ START [WITH start]]\n"
+" [INCREMENT BY increment] [MINVALUE minvalue | NO MINVALUE] [MAXVALUE 
maxvalue | NO MAXVALUE] [CACHE cachevalue] [[NO] CYCLE] ')' ]",
+"seq_int_datatype",
 "See also 
https://www.monetdb.org/documentation/user-guide/sql-manual/data-types/serial-types/"},
{"global_privileges",
 NULL,
diff --git a/sql/ChangeLog b/sql/ChangeLog
--- a/sql/ChangeLog
+++ b/sql/ChangeLog
@@ -16,6 +16,12 @@
   Note: MonetDB does NOT support catalog qualifiers in object names, so all the
   _CATALOG columns in these information_schema views will allways contain NULL.
 
+* Mon Aug 21 2023 Niels Nes 
+- Added support for generated column syntax:
+   GENERATED BY DEFAULT AS IDENTITY ...
+  This allows the user to override the default generated sequence value
+  during inserts.
+
 * Fri Jul 7 2023 Niels Nes 
 - Added SQL support for:  and 
   in   ::=
diff --git a/sql/server/sql_parser.y b/sql/server/sql_parser.y
--- a/sql/server/sql_parser.y
+++ b/sql/server/sql_parser.y
@@ -1906,6 +1906,7 @@ column_def:
}
  |  column serial_or_bigserial
{ /* SERIAL = INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY 
*/
+ /* BIGSERIAL = BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY 
KEY */
/* handle multi-statements by wrapping them in a list */
sql_subtype it;
dlist* stmts;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: groupjoin - rewrite left outer group joins into semi/an...

2023-08-31 Thread Niels Nes via checkin-list
Changeset: 998f526f60c1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/998f526f60c1
Modified Files:
sql/include/sql_relation.h
sql/server/rel_optimize_sel.c
Branch: groupjoin
Log Message:

rewrite left outer group joins into semi/anti joins when possible, ie when the 
result of an exists/in/not in/any/all is used in the projection on which later 
a where/having expression is done.


diffs (67 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
@@ -242,6 +242,7 @@ typedef enum operator_type {
 #define set_semantics(e)   (e)->semantics = 1
 #define is_any(e)  ((e)->any)
 #define set_any(e) (e)->any = 1
+#define reset_any(e)   (e)->any = 0
 #define is_symmetric(e)((e)->symmetric)
 #define set_symmetric(e)   (e)->symmetric = 1
 #define is_intern(e)   ((e)->intern)
diff --git a/sql/server/rel_optimize_sel.c b/sql/server/rel_optimize_sel.c
--- a/sql/server/rel_optimize_sel.c
+++ b/sql/server/rel_optimize_sel.c
@@ -3592,6 +3592,44 @@ rel_use_index(visitor *v, sql_rel *rel)
return rel;
 }
 
+static sql_rel *
+rel_select_leftgroup_2_semi(visitor *v, sql_rel *rel)
+{
+   (void)v;
+   if (rel_is_ref(rel) || !is_select(rel->op) || list_empty(rel->exps))
+   return rel;
+   sql_rel *l = rel->l;
+
+   if (!l || rel_is_ref(l) || !is_left(l->op) || list_empty(l->attr))
+   return rel;
+
+   for(node *n = rel->exps->h; n; n = n->next) {
+   sql_exp *e = n->data;
+
+   if (e->type == e_cmp && !is_semantics(e) && !e->f) {
+   list *attrs = l->attr;
+   sql_exp *a = attrs->h->data;
+
+   if (exps_find_exp(l->attr, e->l) && exp_is_true(e->r) 
&& e->flag == cmp_equal /*&& exp_is_true(a)*/) {
+   printf("# optimize select leftgroup -> semi\n");
+   if (!list_empty(l->exps)) {
+   for(node *m = l->exps->h; m; m = 
m->next) {
+   sql_exp *j = m->data;
+   reset_any(j);
+   }
+   }
+   l->attr = NULL;
+   l->op = exp_is_true(a)?op_semi:op_anti;
+   list_remove_node(rel->exps, NULL, n);
+   rel = rel_project(v->sql->sa, rel, 
rel_projections(v->sql, rel, NULL, 1, 1));
+   list_append(rel->exps, attrs->h->data);
+   v->changes++;
+   return rel;
+   }
+   }
+   }
+   return rel;
+}
 
 static sql_rel *
 rel_optimize_select_and_joins_topdown_(visitor *v, sql_rel *rel)
@@ -3605,6 +3643,7 @@ rel_optimize_select_and_joins_topdown_(v
 
rel = rel_simplify_fk_joins(v, rel);
rel = rel_push_select_down(v, rel);
+   rel = rel_select_leftgroup_2_semi(v, rel);
if (rel && rel->l && (is_select(rel->op) || is_join(rel->op)))
rel = rel_use_index(v, rel);
return rel;
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org