MonetDB: recursive_cte - Merge with default branch.

2024-12-12 Thread Sjoerd Mullender via checkin-list
Changeset: bd76c44e92fe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/bd76c44e92fe
Branch: recursive_cte
Log Message:

Merge with default branch.


diffs (truncated from 576 to 300 lines):

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
@@ -282,7 +282,7 @@ bool GDKexiting(void);
 jmp_buf GDKfataljump;
 bit GDKfataljumpenable;
 str GDKfatalmsg;
-gdk_return GDKfilepath(char *buf, size_t bufsize, int farmid, const char *dir, 
const char *nme, const char *ext) __attribute__((__access__(write_only, 1)));
+gdk_return GDKfilepath(char *buf, size_t bufsize, int farmid, const char *dir, 
const char *nme, const char *ext) __attribute__((__access__(write_only, 1, 2)));
 void GDKfree(void *blk);
 char *GDKgetbuf(void);
 unsigned GDKgetdebug(void);
@@ -301,7 +301,7 @@ MT_Lock *volatile GDKlocklist;
 ATOMIC_FLAG GDKlocklistlock;
 ATOMIC_TYPE GDKlocksleepcnt;
 void GDKlockstatistics(int);
-void *GDKmalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__alloc_size__(1))) __attribute__((__warn_unused_result__));
+void *GDKmalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__alloc_size__(1))) 
__attribute__((__warn_unused_result__));
 size_t GDKmallocated(const void *s);
 size_t GDKmem_cursize(void);
 gdk_return GDKmergeidx(BAT *b, BAT **a, int n_ar);
@@ -324,9 +324,9 @@ stream *GDKstdout;
 ssize_t GDKstrFromStr(unsigned char *restrict dst, const unsigned char 
*restrict src, ssize_t len, char quote);
 int GDKstrcasecmp(const char *s1, const char *s2);
 char *GDKstrcasestr(const char *haystack, const char *needle);
-str GDKstrdup(const char *s) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
+str GDKstrdup(const char *s) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
 int GDKstrncasecmp(const char *str1, const char *str2, size_t l1, size_t l2);
-str GDKstrndup(const char *s, size_t n) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
+str GDKstrndup(const char *s, size_t n) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
 gdk_return GDKtolower(char **restrict buf, size_t *restrict buflen, const char 
*restrict s) __attribute__((__access__(read_write, 1))) 
__attribute__((__access__(read_write, 2)));
 gdk_return GDKtoupper(char **restrict buf, size_t *restrict buflen, const char 
*restrict s) __attribute__((__access__(read_write, 1))) 
__attribute__((__access__(read_write, 2)));
 gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_level);
@@ -348,7 +348,7 @@ gdk_return GDKupgradevarheap(BAT *b, var
 lng GDKusec(void);
 const char *GDKversion(void) __attribute__((__const__));
 size_t GDKvm_cursize(void);
-void *GDKzalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__alloc_size__(1))) __attribute__((__warn_unused_result__));
+void *GDKzalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__alloc_size__(1))) 
__attribute__((__warn_unused_result__));
 void HASHdestroy(BAT *b);
 BUN HASHlist(Hash *h, BUN i);
 BUN HASHprobe(const Hash *h, const void *v);
@@ -912,8 +912,8 @@ const char corrRef[];
 const char countRef[];
 const char count_no_nilRef[];
 int cpyConstant(MalBlkPtr mb, VarPtr vr);
-str createException(enum malexception, const char *, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 
3, 4))) __attribute__((__returns_nonnull__));
-str createMalException(MalBlkPtr, int, enum malexception, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 
4, 5))) __attribute__((__returns_nonnull__));
+str createException(enum malexception, const char *, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__malloc__)) 
__attribute__((__malloc__(freeException, 1))) 
__attribute__((__format__(__printf__, 3, 4))) 
__attribute__((__returns_nonnull__));
+str createMalException(MalBlkPtr, int, enum malexception, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__malloc__)) 
__attribute__((__malloc__(freeException, 1))) 
__attribute__((__format__(__printf__, 4, 5))) 
__attribute__((__returns_nonnull__));
 const char create_functionRef[];
 const char create_roleRef[];
 const char create_schemaRef[];
@@ -1026,7 +1026,7 @@ int getStrConstant(MalBlkPtr mb, str val
 const char getTraceRef[];
 str getTypeIdentifier(malType tpe);
 str getTypeName(malType tpe);
-char *getVarNameIntoBuffer(MalBlkPtr mb, int idx, char *buf);
+char *getVarNameIntoBuffer(MalBlkPtr mb, int idx, char *buf) 
__attribute__((__access__(write_only, 3)));
 const char getVariableRef[];
 Module globalModule(const char *nme);
 const char grantRef[];
@@ -1069,6 +1069,7 @@ str loadLibrary(const char *modulename, 
 char *locate_file(const char *basename, cons

MonetDB: clean_parser - approved output

2024-12-12 Thread Niels Nes via checkin-list
Changeset: 11f535e50ac9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/11f535e50ac9
Modified Files:
sql/test/Users/Tests/userCallFunction.test
sql/test/merge-partitions/Tests/mergepart20.test
sql/test/merge-partitions/Tests/mergepart21.test
sql/test/mergetables/Tests/mergedb_create.test
sql/test/miscellaneous/Tests/simple_selects.test
sql/test/orderidx/Tests/simpletable.test
sql/test/orderidx/Tests/smalltable.test
sql/test/prepare/Tests/sample.15.stable.err
sql/test/subquery/Tests/correlated.test
sql/test/subquery/Tests/subquery4.test
sql/test/sys-schema/Tests/check_ForeignKey_referential_integrity.test
sql/test/sys-schema/Tests/check_PrimaryKey_uniqueness.test
Branch: clean_parser
Log Message:

approved output


diffs (truncated from 335 to 300 lines):

diff --git a/sql/test/Users/Tests/userCallFunction.test 
b/sql/test/Users/Tests/userCallFunction.test
--- a/sql/test/Users/Tests/userCallFunction.test
+++ b/sql/test/Users/Tests/userCallFunction.test
@@ -24,11 +24,11 @@ statement error 42000!SELECT: insufficie
 SELECT s1.f1()
 
 @connection(id=tc)
-statement error 42000!SELECT: insufficient privileges for unary operator 
's1'.'f1'(tinyint)
+statement error 42000!SELECT: insufficient privileges for operator 
's1'.'f1'(tinyint)
 SELECT s1.f1(1)
 
 @connection(id=tc)
-statement error 42000!SELECT: insufficient privileges for unary operator 
's1'.'f1'(int)
+statement error 42000!SELECT: insufficient privileges for operator 
's1'.'f1'(int)
 SELECT s1.f1(cast(1 as int))
 
 @connection(id=tc)
@@ -52,11 +52,11 @@ SELECT s1.f1()
 10
 
 @connection(id=tc)
-statement error 42000!SELECT: insufficient privileges for unary operator 
's1'.'f1'(tinyint)
+statement error 42000!SELECT: insufficient privileges for operator 
's1'.'f1'(tinyint)
 SELECT s1.f1(1)
 
 @connection(id=tc)
-statement error 42000!SELECT: insufficient privileges for unary operator 
's1'.'f1'(int)
+statement error 42000!SELECT: insufficient privileges for operator 
's1'.'f1'(int)
 SELECT s1.f1(cast(1 as int))
 
 statement ok
diff --git a/sql/test/merge-partitions/Tests/mergepart20.test 
b/sql/test/merge-partitions/Tests/mergepart20.test
--- a/sql/test/merge-partitions/Tests/mergepart20.test
+++ b/sql/test/merge-partitions/Tests/mergepart20.test
@@ -69,7 +69,7 @@ query IT rowsort
 SELECT column_id, expression FROM table_partitions
 
 
-statement error 42000!SELECT: no such unary operator 'iamdummy'(int)
+statement error 42000!SELECT: no such operator 'iamdummy'(int)
 CREATE MERGE TABLE testme (a int, b varchar(32)) PARTITION BY RANGE USING 
(iamdummy(a))
 
 statement ok
diff --git a/sql/test/merge-partitions/Tests/mergepart21.test 
b/sql/test/merge-partitions/Tests/mergepart21.test
--- a/sql/test/merge-partitions/Tests/mergepart21.test
+++ b/sql/test/merge-partitions/Tests/mergepart21.test
@@ -87,7 +87,7 @@ DROP FUNCTION dosomething
 statement ok
 CREATE FUNCTION dosomethingelse(i int) RETURNS TABLE (j int) BEGIN RETURN 
TABLE(SELECT i); END
 
-statement error 42000!SELECT: no such unary operator 'dosomethingelse'(int)
+statement error 42000!SELECT: no such operator 'dosomethingelse'(int)
 CREATE MERGE TABLE nexttest (a int, dd real) PARTITION BY VALUES USING 
(dosomethingelse(a))
 
 statement ok
diff --git a/sql/test/mergetables/Tests/mergedb_create.test 
b/sql/test/mergetables/Tests/mergedb_create.test
--- a/sql/test/mergetables/Tests/mergedb_create.test
+++ b/sql/test/mergetables/Tests/mergedb_create.test
@@ -385,7 +385,7 @@ where true
 query TII rowsort
 select
cast(coalesce(ref_8.name,
- cast(nullif(ref_7.column,
+ cast(nullif(ref_7."column",
cast(null as clob)) as clob)) as clob) as c0,
ref_10.id as c1,
cast(coalesce(ref_6.action,
diff --git a/sql/test/miscellaneous/Tests/simple_selects.test 
b/sql/test/miscellaneous/Tests/simple_selects.test
--- a/sql/test/miscellaneous/Tests/simple_selects.test
+++ b/sql/test/miscellaneous/Tests/simple_selects.test
@@ -1122,7 +1122,7 @@ ROLLBACK
 statement error 42000!SELECT: no such binary operator 
'scale_up'(decimal,tinyint)
 select scale_up(12.1, 10)
 
-statement error 42000!SELECT: no such unary operator 'sql_exists'(tinyint)
+statement error 42000!SELECT: no such operator 'sql_exists'(tinyint)
 select sql_exists(1)
 
 statement error 42000!CREATE FUNCTION: name 'scale_down' cannot be used
diff --git a/sql/test/orderidx/Tests/simpletable.test 
b/sql/test/orderidx/Tests/simpletable.test
--- a/sql/test/orderidx/Tests/simpletable.test
+++ b/sql/test/orderidx/Tests/simpletable.test
@@ -21,7 +21,7 @@ 4
 7
 
 query TI rowsort
-SELECT schema, table, column, type, mode, count, hashes, phash, imprints, 
orderidx > 0 FROM storage(current_schema, 'xtmp1')
+SELECT schema, "table", "column", type, mode, count, hashes, phash, imprints, 
orderidx > 0 FROM storage(current_schema, 'xtmp1')
 
 sys
 xtmp1
@@ -41,7 +41,7 @@ statement ok
 CREATE ORDERED INDEX sys_xtmp1_i_oidx ON xtm

MonetDB: clean_parser - merged with recursive cte

2024-12-12 Thread Niels Nes via checkin-list
Changeset: 59e9e61fe4e2 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/59e9e61fe4e2
Branch: clean_parser
Log Message:

merged with recursive cte


diffs (truncated from 576 to 300 lines):

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
@@ -282,7 +282,7 @@ bool GDKexiting(void);
 jmp_buf GDKfataljump;
 bit GDKfataljumpenable;
 str GDKfatalmsg;
-gdk_return GDKfilepath(char *buf, size_t bufsize, int farmid, const char *dir, 
const char *nme, const char *ext) __attribute__((__access__(write_only, 1)));
+gdk_return GDKfilepath(char *buf, size_t bufsize, int farmid, const char *dir, 
const char *nme, const char *ext) __attribute__((__access__(write_only, 1, 2)));
 void GDKfree(void *blk);
 char *GDKgetbuf(void);
 unsigned GDKgetdebug(void);
@@ -301,7 +301,7 @@ MT_Lock *volatile GDKlocklist;
 ATOMIC_FLAG GDKlocklistlock;
 ATOMIC_TYPE GDKlocksleepcnt;
 void GDKlockstatistics(int);
-void *GDKmalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__alloc_size__(1))) __attribute__((__warn_unused_result__));
+void *GDKmalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__alloc_size__(1))) 
__attribute__((__warn_unused_result__));
 size_t GDKmallocated(const void *s);
 size_t GDKmem_cursize(void);
 gdk_return GDKmergeidx(BAT *b, BAT **a, int n_ar);
@@ -324,9 +324,9 @@ stream *GDKstdout;
 ssize_t GDKstrFromStr(unsigned char *restrict dst, const unsigned char 
*restrict src, ssize_t len, char quote);
 int GDKstrcasecmp(const char *s1, const char *s2);
 char *GDKstrcasestr(const char *haystack, const char *needle);
-str GDKstrdup(const char *s) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
+str GDKstrdup(const char *s) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
 int GDKstrncasecmp(const char *str1, const char *str2, size_t l1, size_t l2);
-str GDKstrndup(const char *s, size_t n) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
+str GDKstrndup(const char *s, size_t n) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
 gdk_return GDKtolower(char **restrict buf, size_t *restrict buflen, const char 
*restrict s) __attribute__((__access__(read_write, 1))) 
__attribute__((__access__(read_write, 2)));
 gdk_return GDKtoupper(char **restrict buf, size_t *restrict buflen, const char 
*restrict s) __attribute__((__access__(read_write, 1))) 
__attribute__((__access__(read_write, 2)));
 gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_level);
@@ -348,7 +348,7 @@ gdk_return GDKupgradevarheap(BAT *b, var
 lng GDKusec(void);
 const char *GDKversion(void) __attribute__((__const__));
 size_t GDKvm_cursize(void);
-void *GDKzalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__alloc_size__(1))) __attribute__((__warn_unused_result__));
+void *GDKzalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__alloc_size__(1))) 
__attribute__((__warn_unused_result__));
 void HASHdestroy(BAT *b);
 BUN HASHlist(Hash *h, BUN i);
 BUN HASHprobe(const Hash *h, const void *v);
@@ -912,8 +912,8 @@ const char corrRef[];
 const char countRef[];
 const char count_no_nilRef[];
 int cpyConstant(MalBlkPtr mb, VarPtr vr);
-str createException(enum malexception, const char *, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 
3, 4))) __attribute__((__returns_nonnull__));
-str createMalException(MalBlkPtr, int, enum malexception, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 
4, 5))) __attribute__((__returns_nonnull__));
+str createException(enum malexception, const char *, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__malloc__)) 
__attribute__((__malloc__(freeException, 1))) 
__attribute__((__format__(__printf__, 3, 4))) 
__attribute__((__returns_nonnull__));
+str createMalException(MalBlkPtr, int, enum malexception, _In_z_ 
_Printf_format_string_ const char *, ...) __attribute__((__malloc__)) 
__attribute__((__malloc__(freeException, 1))) 
__attribute__((__format__(__printf__, 4, 5))) 
__attribute__((__returns_nonnull__));
 const char create_functionRef[];
 const char create_roleRef[];
 const char create_schemaRef[];
@@ -1026,7 +1026,7 @@ int getStrConstant(MalBlkPtr mb, str val
 const char getTraceRef[];
 str getTypeIdentifier(malType tpe);
 str getTypeName(malType tpe);
-char *getVarNameIntoBuffer(MalBlkPtr mb, int idx, char *buf);
+char *getVarNameIntoBuffer(MalBlkPtr mb, int idx, char *buf) 
__attribute__((__access__(write_only, 3)));
 const char getVariableRef[];
 Module globalModule(const char *nme);
 const char grantRef[];
@@ -1069,6 +1069,7 @@ str loadLibrary(const char *modulename, 
 char *locate_file(const char *basename, const 

MonetDB: clean_parser - approved output

2024-12-12 Thread Niels Nes via checkin-list
Changeset: ebfbcbd7c0dc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/ebfbcbd7c0dc
Modified Files:
sql/test/Dependencies/Tests/dependency_DBobjects.test
sql/test/SQLancer/Tests/sqlancer09.test
sql/test/cte/Tests/test_correlated_recursive_cte.test
sql/test/emptydb/Tests/check.SQL.py
Branch: clean_parser
Log Message:

approved output


diffs (130 lines):

diff --git a/sql/test/Dependencies/Tests/dependency_DBobjects.test 
b/sql/test/Dependencies/Tests/dependency_DBobjects.test
--- a/sql/test/Dependencies/Tests/dependency_DBobjects.test
+++ b/sql/test/Dependencies/Tests/dependency_DBobjects.test
@@ -662,6 +662,9 @@ SELECT v.name, tri.name, 'DEP_TRIGGER' f
 query TTT nosort
 SELECT f1.name, f2.name, 'DEP_FUNC' from sys.functions as f1, sys.functions as 
f2, sys.dependencies as dep where f1.id = dep.id AND f2.id = dep.depend_id AND 
dep.depend_type = 7 order by f2.name, f1.name
 
+date_to_str
+dayname
+DEP_FUNC
 describe_type
 describe_columns
 DEP_FUNC
@@ -683,6 +686,9 @@ DEP_FUNC
 sq
 get_remote_table_expressions
 DEP_FUNC
+date_to_str
+monthname
+DEP_FUNC
 ms_trunc
 ms_round
 DEP_FUNC
diff --git a/sql/test/SQLancer/Tests/sqlancer09.test 
b/sql/test/SQLancer/Tests/sqlancer09.test
--- a/sql/test/SQLancer/Tests/sqlancer09.test
+++ b/sql/test/SQLancer/Tests/sqlancer09.test
@@ -723,7 +723,7 @@ create or replace view v0(vc0, vc1, vc2)
 statement ok
 create or replace view v1(vc0, vc1) as (select 
round(0.8086382584142731699824473535828292369842529296875, 
0.6571010204254646), '䝀i8jPo' where not (false))
 
-statement error 42000!SELECT: cannot use non GROUP BY column 'v0.vc0' in query 
results without an aggregate function
+statement error 42000!SELECT: non-integer constant in GROUP BY
 select all v0.vc2, greatest(min(all least(-266013300, 864326131)), 
-1183805674), greatest(-544857133, + (v0.vc2)) from v0, v1
 inner join (values (+ (88)), (greatest(0.8732546822607857, 
greatest(1933292715, -525885982))), (case when (-1466474216) in
 (-1504372996, 417052418, 94) then least(28288, 1447812316) when cast('' as 
boolean) then "second"(time '14:18:59') else
diff --git a/sql/test/cte/Tests/test_correlated_recursive_cte.test 
b/sql/test/cte/Tests/test_correlated_recursive_cte.test
--- a/sql/test/cte/Tests/test_correlated_recursive_cte.test
+++ b/sql/test/cte/Tests/test_correlated_recursive_cte.test
@@ -196,7 +196,7 @@ 100
 NULL
 
 # limit in subquery
-skipif knownfail   


+#skipif knownfail  

 
 query I
 SELECT t2.*
 FROM (VALUES (10)) t(_corr), LATERAL (
diff --git a/sql/test/emptydb/Tests/check.SQL.py 
b/sql/test/emptydb/Tests/check.SQL.py
--- a/sql/test/emptydb/Tests/check.SQL.py
+++ b/sql/test/emptydb/Tests/check.SQL.py
@@ -68,8 +68,8 @@ sys_pkeys = [
 ('environment', 'name'),
 ('db_user_info', 'name'),
 ('statistics', 'column_id'),
-('"storage"()', 'schema, table, column'),
-('storagemodelinput', 'schema, table, column'),
+('"storage"()', 'schema, "table", "column"'),
+('storagemodelinput', 'schema, "table", "column"'),
 
 ('rejects', 'rowid'),
 
@@ -204,32 +204,32 @@ sys_fkeys = [
 ('statistics', 'type', 'sqlname', 'types'),
 ('storage()', 'schema', 'name', 'schemas'),
 ('storage()', 'table', 'name', '(SELECT name FROM sys._tables UNION ALL 
SELECT name FROM tmp._tables) as t'),
-('storage()', 'schema, table', 'sname, tname', '(SELECT sch.name as sname, 
tbl.name as tname FROM sys.schemas AS sch JOIN sys.tables AS tbl ON sch.id = 
tbl.schema_id) as t'),
-('storage()', 'column', 'name', '(SELECT name FROM sys._columns UNION ALL 
SELECT name FROM tmp._columns UNION ALL SELECT name FROM sys.keys UNION ALL 
SELECT name FROM tmp.keys UNION ALL SELECT name FROM sys.idxs UNION ALL SELECT 
name FROM tmp.idxs) as c'),
+('storage()', 'schema, "table"', 'sname, tname', '(SELECT sch.name as 
sname, tbl.name as tname FROM sys.schemas AS sch JOIN sys.tables AS tbl ON 
sch.id = tbl.schema_id) as t'),
+('storage()', '"column"', 'name', '(SELECT name FROM sys._columns UNION 
ALL SELECT name FROM tmp._columns UNION ALL SELECT name FROM sys.keys UNION ALL 
SELECT name FROM tmp.keys UNION ALL SELECT name FROM sys.idxs UNION ALL SELECT 
name FROM tmp.idxs) as c'),
 ('storage()', 'type', 'sqlname', 'types'),
 ('storage', 'schema', 'name', 'schemas'),
-('storage', 'table', 'name', '(SELECT name FROM sys._tables UNION ALL 
SELECT name FROM tmp._tables) as t'),
-('storage', 'schema, table', 'sname, tname', '(SELECT sch.name as sname, 
tbl.name as tname FROM sys.schemas AS sch JOIN sys.tables AS tbl ON sch.id = 
tbl.schema_id) as t'),
+('storage', '"table"', 'name', '(SELECT name FROM sys._tables UNION ALL 
S

MonetDB: clean_parser - improved test script

2024-12-12 Thread Niels Nes via checkin-list
Changeset: 0cc006278cdf for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/0cc006278cdf
Modified Files:
sql/test/emptydb/Tests/check.SQL.py
Branch: clean_parser
Log Message:

improved test script


diffs (20 lines):

diff --git a/sql/test/emptydb/Tests/check.SQL.py 
b/sql/test/emptydb/Tests/check.SQL.py
--- a/sql/test/emptydb/Tests/check.SQL.py
+++ b/sql/test/emptydb/Tests/check.SQL.py
@@ -203,14 +203,14 @@ sys_fkeys = [
 ('statistics', 'column_id', 'id', '(SELECT id FROM sys._columns UNION ALL 
SELECT id FROM tmp._columns) as c'),
 ('statistics', 'type', 'sqlname', 'types'),
 ('storage()', 'schema', 'name', 'schemas'),
-('storage()', 'table', 'name', '(SELECT name FROM sys._tables UNION ALL 
SELECT name FROM tmp._tables) as t'),
+('storage()', '"table"', 'name', '(SELECT name FROM sys._tables UNION ALL 
SELECT name FROM tmp._tables) as t'),
 ('storage()', 'schema, "table"', 'sname, tname', '(SELECT sch.name as 
sname, tbl.name as tname FROM sys.schemas AS sch JOIN sys.tables AS tbl ON 
sch.id = tbl.schema_id) as t'),
 ('storage()', '"column"', 'name', '(SELECT name FROM sys._columns UNION 
ALL SELECT name FROM tmp._columns UNION ALL SELECT name FROM sys.keys UNION ALL 
SELECT name FROM tmp.keys UNION ALL SELECT name FROM sys.idxs UNION ALL SELECT 
name FROM tmp.idxs) as c'),
 ('storage()', 'type', 'sqlname', 'types'),
 ('storage', 'schema', 'name', 'schemas'),
 ('storage', '"table"', 'name', '(SELECT name FROM sys._tables UNION ALL 
SELECT name FROM tmp._tables) as t'),
 ('storage', 'schema, "table"', 'sname, tname', '(SELECT sch.name as sname, 
tbl.name as tname FROM sys.schemas AS sch JOIN sys.tables AS tbl ON sch.id = 
tbl.schema_id) as t'),
-('storage', 'column', 'name', '(SELECT name FROM sys._columns UNION ALL 
SELECT name FROM tmp._columns UNION ALL SELECT name FROM sys.keys UNION ALL 
SELECT name FROM tmp.keys UNION ALL SELECT name FROM sys.idxs UNION ALL SELECT 
name FROM tmp.idxs) as c'),
+('storage', '"column"', 'name', '(SELECT name FROM sys._columns UNION ALL 
SELECT name FROM tmp._columns UNION ALL SELECT name FROM sys.keys UNION ALL 
SELECT name FROM tmp.keys UNION ALL SELECT name FROM sys.idxs UNION ALL SELECT 
name FROM tmp.idxs) as c'),
 ('storage', 'type', 'sqlname', 'types'),
 ('storagemodel', 'schema', 'name', 'schemas'),
 ('storagemodel', '"table"', 'name', '(SELECT name FROM sys._tables UNION 
ALL SELECT name FROM tmp._tables) as t'),
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: default - Use const char *.

2024-12-12 Thread Sjoerd Mullender via checkin-list
Changeset: dabf4fd3cc1d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/dabf4fd3cc1d
Modified Files:
clients/Tests/exports.stable.out
gdk/gdk.h
gdk/gdk_bbp.c
gdk/gdk_utils.c
Branch: default
Log Message:

Use const char *.


diffs (186 lines):

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
@@ -527,15 +527,15 @@ int dlclose(void *handle);
 char *dlerror(void);
 void *dlopen(const char *file, int mode);
 void *dlsym(void *handle, const char *name);
-_Noreturn void eb_error(exception_buffer *eb, char *msg, int val);
+_Noreturn void eb_error(exception_buffer *eb, const char *msg, int val);
 exception_buffer *eb_init(exception_buffer *eb) 
__attribute__((__access__(write_only, 1)));
 size_t escapedStr(char *restrict dst, const char *restrict src, size_t dstlen, 
const char *sep1, const char *sep2, int quote);
 size_t escapedStrlen(const char *restrict src, const char *sep1, const char 
*sep2, int quote);
 ssize_t fltFromStr(const char *src, size_t *len, flt **dst, bool external);
 ssize_t fltToStr(str *dst, size_t *len, const flt *src, bool external);
 const flt flt_nil;
-gdk_return gdk_add_callback(char *name, gdk_callback_func *f, int argc, void 
*argv[], int interval);
-gdk_return gdk_remove_callback(char *, gdk_callback_func *f);
+gdk_return gdk_add_callback(const char *name, gdk_callback_func *f, int argc, 
void *argv[], int interval);
+gdk_return gdk_remove_callback(const char *, gdk_callback_func *f);
 bat getBBPsize(void);
 char *get_bin_path(void);
 int gettimeofday(struct timeval *tv, int *ignore_zone);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2532,7 +2532,7 @@ TIMEOUT_TEST(QryCtx *qc)
} while (0)
 
 typedef struct gdk_callback {
-   char *name;
+   const char *name;
int argc;
int interval;  // units sec
lng last_called; // timestamp GDKusec
@@ -2543,9 +2543,9 @@ typedef struct gdk_callback {
 
 typedef gdk_return gdk_callback_func(int argc, void *argv[]);
 
-gdk_export gdk_return gdk_add_callback(char *name, gdk_callback_func *f, int 
argc, void
-   *argv[], int interval);
-gdk_export gdk_return gdk_remove_callback(char *, gdk_callback_func *f);
+gdk_export gdk_return gdk_add_callback(const char *name, gdk_callback_func *f,
+  int argc, void *argv[], int interval);
+gdk_export gdk_return gdk_remove_callback(const char *, gdk_callback_func *f);
 
 
 #include 
@@ -2557,7 +2557,7 @@ typedef struct exception_buffer {
jmp_buf state;
 #endif
int code;
-   char *msg;
+   const char *msg;
int enabled;
 } exception_buffer;
 
@@ -2570,7 +2570,7 @@ gdk_export exception_buffer *eb_init(exc
 #else
 #define eb_savepoint(eb) ((eb)->enabled = 1, setjmp((eb)->state))
 #endif
-gdk_export _Noreturn void eb_error(exception_buffer *eb, char *msg, int val);
+gdk_export _Noreturn void eb_error(exception_buffer *eb, const char *msg, int 
val);
 
 typedef struct allocator {
struct allocator *pa;
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -4457,7 +4457,7 @@ static struct {
  * Adds new callback to the callback list.
  */
 gdk_return
-gdk_add_callback(char *name, gdk_callback_func *f, int argc, void *argv[], int
+gdk_add_callback(const char *name, gdk_callback_func *f, int argc, void 
*argv[], int
interval)
 {
 
@@ -4512,7 +4512,7 @@ gdk_add_callback(char *name, gdk_callbac
  * Removes a callback from the callback list with a given name as an argument.
  */
 gdk_return
-gdk_remove_callback(char *cb_name, gdk_callback_func *argsfree)
+gdk_remove_callback(const char *cb_name, gdk_callback_func *argsfree)
 {
gdk_callback *prev = NULL;
gdk_return res = GDK_FAIL;
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -2056,7 +2056,7 @@ eb_init(exception_buffer *eb)
 }
 
 void
-eb_error( exception_buffer *eb, char *msg, int val )
+eb_error(exception_buffer *eb, const char *msg, int val)
 {
eb->code = val;
eb->msg = msg;
@@ -2076,7 +2076,7 @@ typedef struct freed_t {
 } freed_t;
 
 static void
-sa_destroy_freelist( freed_t *f )
+sa_destroy_freelist(freed_t *f)
 {
while(f) {
freed_t *n = f->n;
@@ -2152,7 +2152,7 @@ sa_create(allocator *pa)
return sa;
 }
 
-allocator *sa_reset( allocator *sa )
+allocator *sa_reset(allocator *sa)
 {
size_t i ;
 
@@ -2171,7 +2171,7 @@ allocator *sa_reset( allocator *sa )
 #undef sa_realloc
 #undef sa_alloc
 void *
-sa_realloc( allocator *sa, void *p, size_t sz, size_t oldsz )
+sa_realloc(allocator *sa, void *p, size_t sz, size_t oldsz)
 {
void *r = sa_alloc(sa, sz);
 
@@ -2182,7 +2182,7 @@ sa_realloc( allocator *sa, void *p, size
 
 #define round16(sz) ((sz+15)&~15)
 void *
-sa_alloc( allocator *sa, size_t sz )
+sa_alloc(allo

MonetDB: clean_parser - approved output (new functions dayname /...

2024-12-12 Thread Niels Nes via checkin-list
Changeset: 90363ea40e5d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/90363ea40e5d
Modified Files:
sql/test/Dependencies/Tests/dependency_owner_schema_3.test
Branch: clean_parser
Log Message:

approved output (new functions dayname /monthname)


diffs (16 lines):

diff --git a/sql/test/Dependencies/Tests/dependency_owner_schema_3.test 
b/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
--- a/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
+++ b/sql/test/Dependencies/Tests/dependency_owner_schema_3.test
@@ -1285,6 +1285,12 @@ SELECT v.name, tri.name, 'DEP_TRIGGER' f
 query TTT nosort
 SELECT f1.name, f2.name, 'DEP_FUNC' from sys.functions as f1, sys.functions as 
f2, sys.dependencies as dep where f1.id = dep.id AND f2.id = dep.depend_id AND 
dep.depend_type = 7 ORDER BY f1.name, f2.name
 
+date_to_str
+dayname
+DEP_FUNC
+date_to_str
+monthname
+DEP_FUNC
 decypher
 get_remote_table_expressions
 DEP_FUNC
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: ordered-set-aggregates - merged with default

2024-12-12 Thread Niels Nes via checkin-list
Changeset: 297a9a43ae9f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/297a9a43ae9f
Removed Files:
monetdb5/optimizer/opt_prelude.c
monetdb5/optimizer/opt_prelude.h
Modified Files:
clients/Tests/exports.stable.out
monetdb5/mal/mal_namespace.c
monetdb5/mal/mal_namespace.h
monetdb5/modules/atoms/str.c
sql/backends/monet5/rel_bin.c
sql/backends/monet5/sql_cat.c
sql/backends/monet5/sql_statement.c
sql/common/sql_types.c
sql/storage/bat/bat_logger.c
sql/storage/store.c
Branch: ordered-set-aggregates
Log Message:

merged with default


diffs (truncated from 6871 to 300 lines):

diff --git a/clients/mapilib/connect.c b/clients/mapilib/connect.c
--- a/clients/mapilib/connect.c
+++ b/clients/mapilib/connect.c
@@ -797,10 +797,11 @@ mapi_handshake(Mapi mid)
if (motdlen > 0) {
mid->motd = malloc(motdlen + 1);
*mid->motd = 0;
+   char *p = mid->motd;
for (i = 0; i < result->cache.writer; i++)
if (result->cache.line[i].rows && 
result->cache.line[i].rows[0] == '#') {
-   strcat(mid->motd, 
result->cache.line[i].rows);
-   strcat(mid->motd, "\n");
+   p = stpcpy(p, 
result->cache.line[i].rows);
+   p = stpcpy(p, "\n");
}
}
 
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1561,10 +1561,8 @@ add_error(struct MapiResultSet *result, 
REALLOC(result->errorstr, size + strlen(error) + 2);
if (result->errorstr == NULL)
result->errorstr = mapi_nomem;
-   else {
-   strcpy(result->errorstr + size, error);
-   strcat(result->errorstr + size, "\n");
-   }
+   else
+   stpcpy(stpcpy(result->errorstr + size, error), "\n");
 }
 
 const char *
diff --git a/common/stream/memio.c b/common/stream/memio.c
--- a/common/stream/memio.c
+++ b/common/stream/memio.c
@@ -20,9 +20,11 @@ buffer_init(buffer *restrict b, char *re
 {
if (b == NULL || buf == NULL)
return;
-   b->pos = 0;
-   b->buf = buf;
-   b->len = size;
+   *b = (buffer) {
+   .pos = 0,
+   .buf = buf,
+   .len = size,
+   };
 }
 
 buffer *
diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -23,8 +23,17 @@
 #define GCC_Pragma(pragma)
 #endif
 
+#if defined(__has_attribute)
+#if ! __has_attribute(__access__)
+#define __access__(...)
+#endif
+#else
+#define __access__(...)
+#endif
+
 /* copy at most (n-1) bytes from src to dst and add a terminating NULL
  * byte; return length of src (i.e. can be more than what is copied) */
+__attribute__((__access__(write_only, 1, 3)))
 static inline size_t
 strcpy_len(char *restrict dst, const char *restrict src, size_t n)
 {
@@ -63,6 +72,8 @@ GCC_Pragma("GCC diagnostic pop")
 
 /* copy the NULL terminated list of src strings with a maximum of n
  * bytes to dst; return the combined length of the src strings */
+__attribute__((__access__(write_only, 1, 2)))
+__attribute__((__sentinel__))
 static inline size_t
 strconcat_len(char *restrict dst, size_t n, const char *restrict src, ...)
 {
diff --git a/ctest/tools/monetdbe/example_copy.c 
b/ctest/tools/monetdbe/example_copy.c
--- a/ctest/tools/monetdbe/example_copy.c
+++ b/ctest/tools/monetdbe/example_copy.c
@@ -21,8 +21,8 @@
 int
 main(void)
 {
-   char sql[1000];
char csv_path[PATH_MAX];
+   char sql[sizeof(csv_path) + 60];
char* err = NULL;
monetdbe_database mdbe;
monetdbe_result* result = NULL;
@@ -44,22 +44,21 @@ main(void)
}
strcat(csv_path, "/test.csv");
 
-   strcpy(sql, "COPY SELECT * FROM test INTO '");
-   strcat(sql, csv_path);
-   strcat(sql, "' USING DELIMITERS ','");
+   snprintf(sql, sizeof(sql),
+"COPY SELECT * FROM test INTO '%s' USING DELIMITERS 
','",
+csv_path);
 
if ((err = monetdbe_query(mdbe, sql, NULL, NULL)) != NULL)
error(err)
-   
+
if ((err = monetdbe_query(mdbe, "CREATE TABLE test_copy (x integer, y 
string, ts timestamp, dt date, t time, b blob)", NULL, NULL)) != NULL) {
delete_file(csv_path)
error(err)
}
 
-   memset(sql, 0, 1000);
-   strcpy(sql, "COPY INTO test_copy FROM '");
-   strcat(sql, csv_path);
-   strcat(sql, "' DELIMITERS ','");
+   snprintf(sql, sizeof(sql),
+"COPY INTO test_copy FROM '%s' DELIMITERS ','",
+csv_path);
 
if ((err = monetdbe_query(mdbe, sql, NULL

MonetDB: recursive_cte - merged with default

2024-12-12 Thread Niels Nes via checkin-list
Changeset: 6d37edc704c0 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6d37edc704c0
Modified Files:
monetdb5/optimizer/opt_commonTerms.c
Branch: recursive_cte
Log Message:

merged with default


diffs (truncated from 456 to 300 lines):

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
@@ -527,15 +527,15 @@ int dlclose(void *handle);
 char *dlerror(void);
 void *dlopen(const char *file, int mode);
 void *dlsym(void *handle, const char *name);
-_Noreturn void eb_error(exception_buffer *eb, char *msg, int val);
+_Noreturn void eb_error(exception_buffer *eb, const char *msg, int val);
 exception_buffer *eb_init(exception_buffer *eb) 
__attribute__((__access__(write_only, 1)));
 size_t escapedStr(char *restrict dst, const char *restrict src, size_t dstlen, 
const char *sep1, const char *sep2, int quote);
 size_t escapedStrlen(const char *restrict src, const char *sep1, const char 
*sep2, int quote);
 ssize_t fltFromStr(const char *src, size_t *len, flt **dst, bool external);
 ssize_t fltToStr(str *dst, size_t *len, const flt *src, bool external);
 const flt flt_nil;
-gdk_return gdk_add_callback(char *name, gdk_callback_func *f, int argc, void 
*argv[], int interval);
-gdk_return gdk_remove_callback(char *, gdk_callback_func *f);
+gdk_return gdk_add_callback(const char *name, gdk_callback_func *f, int argc, 
void *argv[], int interval);
+gdk_return gdk_remove_callback(const char *, gdk_callback_func *f);
 bat getBBPsize(void);
 char *get_bin_path(void);
 int gettimeofday(struct timeval *tv, int *ignore_zone);
diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -24,7 +24,7 @@
 #endif
 
 #if defined(__has_attribute)
-#if ! __has_attribute(access)
+#if ! __has_attribute(__access__)
 #define __access__(...)
 #endif
 #else
@@ -33,7 +33,8 @@
 
 /* copy at most (n-1) bytes from src to dst and add a terminating NULL
  * byte; return length of src (i.e. can be more than what is copied) */
-static inline size_t __attribute__((__access__(write_only, 1, 3)))
+__attribute__((__access__(write_only, 1, 3)))
+static inline size_t
 strcpy_len(char *restrict dst, const char *restrict src, size_t n)
 {
if (dst != NULL && n != 0) {
@@ -71,7 +72,9 @@ GCC_Pragma("GCC diagnostic pop")
 
 /* copy the NULL terminated list of src strings with a maximum of n
  * bytes to dst; return the combined length of the src strings */
-static inline size_t __attribute__((__access__(write_only, 1, 2)))
+__attribute__((__access__(write_only, 1, 2)))
+__attribute__((__sentinel__))
+static inline size_t
 strconcat_len(char *restrict dst, size_t n, const char *restrict src, ...)
 {
va_list ap;
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2532,7 +2532,7 @@ TIMEOUT_TEST(QryCtx *qc)
} while (0)
 
 typedef struct gdk_callback {
-   char *name;
+   const char *name;
int argc;
int interval;  // units sec
lng last_called; // timestamp GDKusec
@@ -2543,9 +2543,9 @@ typedef struct gdk_callback {
 
 typedef gdk_return gdk_callback_func(int argc, void *argv[]);
 
-gdk_export gdk_return gdk_add_callback(char *name, gdk_callback_func *f, int 
argc, void
-   *argv[], int interval);
-gdk_export gdk_return gdk_remove_callback(char *, gdk_callback_func *f);
+gdk_export gdk_return gdk_add_callback(const char *name, gdk_callback_func *f,
+  int argc, void *argv[], int interval);
+gdk_export gdk_return gdk_remove_callback(const char *, gdk_callback_func *f);
 
 
 #include 
@@ -2557,7 +2557,7 @@ typedef struct exception_buffer {
jmp_buf state;
 #endif
int code;
-   char *msg;
+   const char *msg;
int enabled;
 } exception_buffer;
 
@@ -2570,7 +2570,7 @@ gdk_export exception_buffer *eb_init(exc
 #else
 #define eb_savepoint(eb) ((eb)->enabled = 1, setjmp((eb)->state))
 #endif
-gdk_export _Noreturn void eb_error(exception_buffer *eb, char *msg, int val);
+gdk_export _Noreturn void eb_error(exception_buffer *eb, const char *msg, int 
val);
 
 typedef struct allocator {
struct allocator *pa;
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -4457,7 +4457,7 @@ static struct {
  * Adds new callback to the callback list.
  */
 gdk_return
-gdk_add_callback(char *name, gdk_callback_func *f, int argc, void *argv[], int
+gdk_add_callback(const char *name, gdk_callback_func *f, int argc, void 
*argv[], int
interval)
 {
 
@@ -4512,7 +4512,7 @@ gdk_add_callback(char *name, gdk_callbac
  * Removes a callback from the callback list with a given name as an argument.
  */
 gdk_return
-gdk_remove_callback(char *cb_name, gdk_callback_func *argsfree)
+gdk_remove_callback(const char *cb_name, gdk_callback_func *argsfree)
 {
gdk_callback *prev = NULL;
gdk_return res = GDK

MonetDB: recursive_cte - Test normalization.

2024-12-12 Thread Sjoerd Mullender via checkin-list
Changeset: fd44cced788e for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/fd44cced788e
Modified Files:
sql/test/cte/Tests/cte_colname_issue_10074.test
sql/test/cte/Tests/game_of_life.test
sql/test/cte/Tests/incorrect_recursive_cte.test
sql/test/cte/Tests/insert_cte_bug_3417.test
sql/test/cte/Tests/recursive_cte_complex_pipelines.test
sql/test/cte/Tests/recursive_cte_error.test
sql/test/cte/Tests/recursive_hang_2745.test
sql/test/cte/Tests/test_correlated_recursive_cte.test
sql/test/cte/Tests/test_cte.test
sql/test/cte/Tests/test_cte_in_cte.test
sql/test/cte/Tests/test_cte_overflow.test
sql/test/cte/Tests/test_issue_5673.test
sql/test/cte/Tests/test_nested_recursive_cte.test
sql/test/cte/Tests/test_outer_joins_recursive_cte.test
sql/test/cte/Tests/test_recursive_cte_tutorial.test
sql/test/cte/Tests/test_recursive_cte_union.test
sql/test/cte/Tests/test_recursive_cte_union_all.test
sql/test/miscellaneous/Tests/decimal-atoms.test
Branch: recursive_cte
Log Message:

Test normalization.


diffs (truncated from 1359 to 300 lines):

diff --git a/sql/test/cte/Tests/cte_colname_issue_10074.test 
b/sql/test/cte/Tests/cte_colname_issue_10074.test
--- a/sql/test/cte/Tests/cte_colname_issue_10074.test
+++ b/sql/test/cte/Tests/cte_colname_issue_10074.test
@@ -2,7 +2,8 @@ statement ok
 create table t as with q(id,s) as (values(1,42)), a(s) as (select 42)
 select id from q join a on q.s=a.s
 
-query I
+query I nosort
 select id from t
 
 1
+
diff --git a/sql/test/cte/Tests/game_of_life.test 
b/sql/test/cte/Tests/game_of_life.test
--- a/sql/test/cte/Tests/game_of_life.test
+++ b/sql/test/cte/Tests/game_of_life.test
@@ -1,8 +1,8 @@
 statement ok
-create table series as select * from generate_series(-1,1+1) x(n);
+create table series as select * from generate_series(-1,1+1) x(n)
 
 # conway
-query III
+query III nosort
 with recursive generation1(x,y) as (   --the initial board setup
   select 2, 3
   union all
@@ -37,7 +37,7 @@ 4
 3
 4
 
-query III
+query III nosort
 with recursive generation1(x,y) as (   --the initial board setup
   select 2, 3
   union
@@ -71,3 +71,4 @@ 3
 4
 3
 4
+
diff --git a/sql/test/cte/Tests/incorrect_recursive_cte.test 
b/sql/test/cte/Tests/incorrect_recursive_cte.test
--- a/sql/test/cte/Tests/incorrect_recursive_cte.test
+++ b/sql/test/cte/Tests/incorrect_recursive_cte.test
@@ -1,6 +1,6 @@
 # recursive CTE without UNION is just a normal CTE
-query I
-WITH RECURSIVE cte AS (SELECT 42) SELECT * FROM cte;
+query I nosort
+WITH RECURSIVE cte AS (SELECT 42) SELECT * FROM cte
 
 42
 
@@ -12,3 +12,4 @@ with recursive t as (select 1 as x inter
 statement error
 with recursive t as (select 1 as x except select x+1 from t where x < 3) 
select * from t order by x
 
+
diff --git a/sql/test/cte/Tests/insert_cte_bug_3417.test 
b/sql/test/cte/Tests/insert_cte_bug_3417.test
--- a/sql/test/cte/Tests/insert_cte_bug_3417.test
+++ b/sql/test/cte/Tests/insert_cte_bug_3417.test
@@ -1,9 +1,10 @@
 statement ok
-CREATE TABLE table1 (id INTEGER, a INTEGER);
+CREATE TABLE table1 (id INTEGER, a INTEGER)
 
 statement ok
-CREATE TABLE table2 (table1_id INTEGER);
+CREATE TABLE table2 (table1_id INTEGER)
 
 statement error
 INSERT INTO table2 WITH cte AS (INSERT INTO table1 SELECT 1, 2 RETURNING id) 
SELECT id FROM cte;
 
+
diff --git a/sql/test/cte/Tests/recursive_cte_complex_pipelines.test 
b/sql/test/cte/Tests/recursive_cte_complex_pipelines.test
--- a/sql/test/cte/Tests/recursive_cte_complex_pipelines.test
+++ b/sql/test/cte/Tests/recursive_cte_complex_pipelines.test
@@ -1,5 +1,5 @@
 # recursive CTE with various cross products
-query I
+query I nosort
 WITH RECURSIVE t AS
 (
SELECT CAST(1 as BIGINT) AS x
@@ -8,7 +8,7 @@ UNION
FROM t t1, t t2, t t3
WHERE t1.x < 100
 )
-SELECT * FROM t ORDER BY 1;
+SELECT * FROM t ORDER BY 1
 
 1
 3
@@ -18,7 +18,7 @@ 81
 243
 
 # what if we have different types?
-query I
+query I nosort
 WITH RECURSIVE t AS
 (
SELECT cast(1 as HUGEINT) AS x
@@ -27,7 +27,7 @@ UNION
FROM t t1, t t2, t t3
WHERE t1.x < 100
 )
-SELECT * FROM t ORDER BY 1;
+SELECT * FROM t ORDER BY 1
 
 1
 3
@@ -40,7 +40,7 @@ statement ok
 CREATE TABLE a AS SELECT * FROM generate_series(1,100+1) t1(i)
 
 # recursive CTE with aggregates
-query I
+query I nosort
 WITH RECURSIVE t AS
 (
SELECT cast(1 as BIGINT) AS x
@@ -49,7 +49,7 @@ UNION
FROM t, a
WHERE x < 100
 )
-SELECT * FROM t ORDER BY 1 NULLS LAST;
+SELECT * FROM t ORDER BY 1 NULLS LAST
 
 1
 100
@@ -58,7 +58,7 @@ 100
 NULL
 
 # the same but with a hash join
-query I
+query I nosort
 WITH RECURSIVE t AS
 (
SELECT cast(1 as BIGINT) AS x
@@ -67,12 +67,12 @@ UNION
FROM t, a
WHERE x < 100 AND t.x=a.i
 )
-SELECT * FROM t ORDER BY 1 NULLS LAST;
+SELECT * FROM t ORDER BY 1 NULLS LAST
 
 1
 
 # nested a

MonetDB: default - Layout.

2024-12-12 Thread Sjoerd Mullender via checkin-list
Changeset: 2928a54dd0f1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/2928a54dd0f1
Modified Files:
common/utils/mstring.h
gdk/gdk_utils.c
geom/lib/libgeom.c
monetdb5/mal/mal_exception.c
monetdb5/optimizer/opt_commonTerms.c
sql/storage/bat/bat_logger.c
sql/storage/store.c
Branch: default
Log Message:

Layout.


diffs (288 lines):

diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -33,7 +33,8 @@
 
 /* copy at most (n-1) bytes from src to dst and add a terminating NULL
  * byte; return length of src (i.e. can be more than what is copied) */
-static inline size_t __attribute__((__access__(write_only, 1, 3)))
+__attribute__((__access__(write_only, 1, 3)))
+static inline size_t
 strcpy_len(char *restrict dst, const char *restrict src, size_t n)
 {
if (dst != NULL && n != 0) {
@@ -71,7 +72,8 @@ GCC_Pragma("GCC diagnostic pop")
 
 /* copy the NULL terminated list of src strings with a maximum of n
  * bytes to dst; return the combined length of the src strings */
-static inline size_t __attribute__((__access__(write_only, 1, 2)))
+__attribute__((__access__(write_only, 1, 2)))
+static inline size_t
 strconcat_len(char *restrict dst, size_t n, const char *restrict src, ...)
 {
va_list ap;
diff --git a/gdk/gdk_utils.c b/gdk/gdk_utils.c
--- a/gdk/gdk_utils.c
+++ b/gdk/gdk_utils.c
@@ -339,7 +339,8 @@ GDKcopyenv(BAT **key, BAT **val, bool wr
  * Single-lined comments can now be logged safely, together with
  * process, thread and user ID, and the current time.
  */
-static void __attribute__((__format__(__printf__, 2, 3)))
+__attribute__((__format__(__printf__, 2, 3)))
+static void
 GDKlog(FILE *lockFile, const char *format, ...)
 {
va_list ap;
@@ -2152,7 +2153,8 @@ sa_create(allocator *pa)
return sa;
 }
 
-allocator *sa_reset(allocator *sa)
+allocator *
+sa_reset(allocator *sa)
 {
size_t i ;
 
@@ -2235,7 +2237,8 @@ sa_alloc(allocator *sa, size_t sz)
 }
 
 #undef sa_zalloc
-void *sa_zalloc(allocator *sa, size_t sz)
+void *
+sa_zalloc(allocator *sa, size_t sz)
 {
void *r = sa_alloc(sa, sz);
 
@@ -2244,7 +2247,8 @@ void *sa_zalloc(allocator *sa, size_t sz
return r;
 }
 
-void sa_destroy(allocator *sa)
+void
+sa_destroy(allocator *sa)
 {
if (sa->pa) {
sa_reset(sa);
@@ -2261,7 +2265,8 @@ void sa_destroy(allocator *sa)
 }
 
 #undef sa_strndup
-char *sa_strndup(allocator *sa, const char *s, size_t l)
+char *
+sa_strndup(allocator *sa, const char *s, size_t l)
 {
char *r = sa_alloc(sa, l+1);
 
@@ -2273,12 +2278,14 @@ char *sa_strndup(allocator *sa, const ch
 }
 
 #undef sa_strdup
-char *sa_strdup(allocator *sa, const char *s)
+char *
+sa_strdup(allocator *sa, const char *s)
 {
return sa_strndup(sa, s, strlen(s));
 }
 
-char *sa_strconcat(allocator *sa, const char *s1, const char *s2)
+char *
+sa_strconcat(allocator *sa, const char *s1, const char *s2)
 {
size_t l1 = strlen(s1);
size_t l2 = strlen(s2);
@@ -2292,7 +2299,8 @@ char *sa_strconcat(allocator *sa, const 
return r;
 }
 
-size_t sa_size(allocator *sa)
+size_t
+sa_size(allocator *sa)
 {
return sa->usedmem;
 }
diff --git a/geom/lib/libgeom.c b/geom/lib/libgeom.c
--- a/geom/lib/libgeom.c
+++ b/geom/lib/libgeom.c
@@ -20,7 +20,8 @@
 #include "monetdb_config.h"
 #include "libgeom.h"
 
-static void __attribute__((__format__(__printf__, 1, 2)))
+__attribute__((__format__(__printf__, 1, 2)))
+static void
 geomerror(_In_z_ _Printf_format_string_ const char *fmt, ...)
 {
va_list va;
diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c
--- a/monetdb5/mal/mal_exception.c
+++ b/monetdb5/mal/mal_exception.c
@@ -77,7 +77,8 @@ concatErrors(char *err1, const char *err
  * showException such that they share the same code, because reuse
  * is good.
  */
-static str __attribute__((__format__(__printf__, 3, 0), __returns_nonnull__))
+__attribute__((__format__(__printf__, 3, 0), __returns_nonnull__))
+static str
 createExceptionInternal(enum malexception type, const char *fcn,
const char *format, va_list ap)
 {
@@ -192,7 +193,8 @@ freeException(str msg)
  * showScriptException such that they share the same code, because reuse
  * is good.
  */
-static str __attribute__((__format__(__printf__, 5, 0), __returns_nonnull__))
+__attribute__((__format__(__printf__, 5, 0), __returns_nonnull__))
+static str
 createMalExceptionInternal(MalBlkPtr mb, int pc, enum malexception type,
   char *prev, const char 
*format, va_list ap)
 {
diff --git a/monetdb5/optimizer/opt_commonTerms.c 
b/monetdb5/optimizer/opt_commonTerms.c
--- a/monetdb5/optimizer/opt_commonTerms.c
+++ b/monetdb5/optimizer/opt_commonTerms.c
@@ -33,7 +33,8 @@ isProjectConst(const InstrRecord *p)
return (getModuleId(p) == algebraRef && getFunctionId

MonetDB: clean_parser - approved output

2024-12-12 Thread Niels Nes via checkin-list
Changeset: 9ac2dc448cfe for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/9ac2dc448cfe
Modified Files:
sql/test/Dependencies/Tests/dependency_functions.test
Branch: clean_parser
Log Message:

approved output


diffs (43 lines):

diff --git a/sql/test/Dependencies/Tests/dependency_functions.test 
b/sql/test/Dependencies/Tests/dependency_functions.test
--- a/sql/test/Dependencies/Tests/dependency_functions.test
+++ b/sql/test/Dependencies/Tests/dependency_functions.test
@@ -43,6 +43,9 @@ END
 query TTT nosort
 SELECT f1.name, f2.name, 'DEP_FUNC' from sys.functions as f1, sys.functions as 
f2, sys.dependencies as dep where f1.id = dep.id AND f2.id = dep.depend_id AND 
dep.depend_type = 7 order by f2.name, f1.name
 
+date_to_str
+dayname
+DEP_FUNC
 describe_type
 describe_columns
 DEP_FUNC
@@ -70,6 +73,9 @@ DEP_FUNC
 sq
 get_remote_table_expressions
 DEP_FUNC
+date_to_str
+monthname
+DEP_FUNC
 ms_trunc
 ms_round
 DEP_FUNC
@@ -110,6 +116,9 @@ DROP ALL FUNCTION f1
 query TTT nosort
 SELECT f1.name, f2.name, 'DEP_FUNC' from sys.functions as f1, sys.functions as 
f2, sys.dependencies as dep where f1.id = dep.id AND f2.id = dep.depend_id AND 
dep.depend_type = 7 order by f2.name, f1.name
 
+date_to_str
+dayname
+DEP_FUNC
 describe_type
 describe_columns
 DEP_FUNC
@@ -128,6 +137,9 @@ DEP_FUNC
 sq
 get_remote_table_expressions
 DEP_FUNC
+date_to_str
+monthname
+DEP_FUNC
 ms_trunc
 ms_round
 DEP_FUNC
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


monetdb-java: default - Add double quotes also round column name...

2024-12-12 Thread Martin van Dinther via checkin-list
Changeset: 540d8b5944b1 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java/rev/540d8b5944b1
Modified Files:
src/main/java/org/monetdb/util/MDBvalidator.java
Branch: default
Log Message:

Add double quotes also round column names: type and language. They are keywords 
and may become reserved keywords in the future.


diffs (truncated from 351 to 300 lines):

diff --git a/src/main/java/org/monetdb/util/MDBvalidator.java 
b/src/main/java/org/monetdb/util/MDBvalidator.java
--- a/src/main/java/org/monetdb/util/MDBvalidator.java
+++ b/src/main/java/org/monetdb/util/MDBvalidator.java
@@ -278,7 +278,7 @@ public final class MDBvalidator {
// fetch the primary or unique key info from the MonetDB system 
tables
final StringBuilder sb = new StringBuilder(400);
sb.append(" FROM sys.keys k JOIN sys.tables t ON k.table_id = 
t.id JOIN sys.schemas s ON t.schema_id = s.id"
-   + " WHERE k.type = ").append(pkey ? 0 : 1)  
// 0 = primary keys, 1 = unique keys
+   + " WHERE k.\"type\" = ").append(pkey ? 0 : 1)  
// 0 = primary keys, 1 = unique keys
.append(" and s.name = '").append(schema).append('\'');
String qry = sb.toString();
final int count = runCountQuery(qry);
@@ -291,7 +291,7 @@ public final class MDBvalidator {
// fetch the primary or unique key info including 
columns from the MonetDB system tables
sb.append("SELECT s.name as sch_nm, t.name as tbl_nm, 
k.name as key_nm, o.name as col_nm, o.nr")
.append(" FROM sys.keys k JOIN sys.objects o ON k.id = 
o.id JOIN sys.tables t ON k.table_id = t.id JOIN sys.schemas s ON t.schema_id = 
s.id"
-   + " WHERE k.type = ").append(pkey ? 0 : 1)  
// 0 = primary keys, 1 = unique keys
+   + " WHERE k.\"type\" = ").append(pkey ? 0 : 1)  
// 0 = primary keys, 1 = unique keys
.append(" and s.name = '").append(schema).append('\'')
.append(" ORDER BY t.name, k.name, o.nr;");
qry = sb.toString();
@@ -406,7 +406,7 @@ public final class MDBvalidator {
// fetch the foreign key info from the MonetDB system tables
final StringBuilder sb = new StringBuilder(400);
sb.append(" FROM sys.keys k JOIN sys.tables t ON k.table_id = 
t.id JOIN sys.schemas s ON t.schema_id = s.id"
-   + " WHERE k.type = 2")  // 2 = foreign keys
+   + " WHERE k.\"type\" = 2")  // 2 = foreign 
keys
.append(" and s.name = '").append(schema).append('\'');
String qry = sb.toString();
final int count = runCountQuery(qry);
@@ -429,7 +429,7 @@ public final class MDBvalidator {
" JOIN sys.objects po ON pk.id = po.id" +
" JOIN sys.tables pt ON pk.table_id = pt.id" +
" JOIN sys.schemas ps ON pt.schema_id = ps.id" +
-   " WHERE fk.type = 2" +  // 2 = foreign keys
+   " WHERE fk.\"type\" = 2" +  // 2 = foreign 
keys
" AND fo.nr = po.nr")   // important: matching 
fk-pk column ordering
.append(" AND fs.name = '").append(schema).append('\'')
.append(" ORDER BY ft.name, fk.name, fo.nr;");
@@ -550,7 +550,7 @@ public final class MDBvalidator {
if (colx.endsWith("name") || 
colx.endsWith("keyword")
 || "\"schema\"".equals(colx) 
|| "\"table\"".equals(colx) || "\"column\"".equals(colx)
 || "func".equals(colx) || 
"mod".equals(colx) || "statement".equals(colx)
-|| ("type".equals(colx) && 
("_columns".equals(tbl) || "args".equals(tbl) || "storage()".equals(tbl) || 
"storagemodelinput".equals(tbl {
+|| ("\"type\"".equals(colx) && 
("_columns".equals(tbl) || "args".equals(tbl) || "storage()".equals(tbl) || 
"storagemodelinput".equals(tbl {
isNullCond.append(" OR 
").append(colx).append(" = ''");
}
}
@@ -561,7 +561,7 @@ public final class MDBvalidator {
if (col.endsWith("name") || 
col.endsWith("keyword")
 || "\"schema\"".equals(col) || 
"\"table\"".equals(col) || "\"column\"".equals(col)
 || "func".equals(col) || 
"mod".equals(col) || "statement".equals(col)
- 

monetdb-java: default - Add double quotes around column names wh...

2024-12-12 Thread Martin van Dinther via checkin-list
Changeset: 80ade6a717c2 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java/rev/80ade6a717c2
Modified Files:
src/main/java/org/monetdb/util/MDBvalidator.java
Branch: default
Log Message:

Add double quotes around column names which will become reserved keywords: 
schema, table, column.
These are used in system tables/views/functions: schemastorage, statistics, 
storage(), storage, storagemodel, storagemodelinput, tablestorage, 
tablestoragemodel.


diffs (144 lines):

diff --git a/src/main/java/org/monetdb/util/MDBvalidator.java 
b/src/main/java/org/monetdb/util/MDBvalidator.java
--- a/src/main/java/org/monetdb/util/MDBvalidator.java
+++ b/src/main/java/org/monetdb/util/MDBvalidator.java
@@ -548,7 +548,8 @@ public final class MDBvalidator {
 
/* for some sys/tmp columns 
also check for empty strings */
if (colx.endsWith("name") || 
colx.endsWith("keyword")
-|| "schema".equals(colx) || 
"table".equals(colx) || "column".equals(colx) || "func".equals(colx) || 
"mod".equals(colx) || "statement".equals(colx)
+|| "\"schema\"".equals(colx) 
|| "\"table\"".equals(colx) || "\"column\"".equals(colx)
+|| "func".equals(colx) || 
"mod".equals(colx) || "statement".equals(colx)
 || ("type".equals(colx) && 
("_columns".equals(tbl) || "args".equals(tbl) || "storage()".equals(tbl) || 
"storagemodelinput".equals(tbl {
isNullCond.append(" OR 
").append(colx).append(" = ''");
}
@@ -558,7 +559,8 @@ public final class MDBvalidator {
 
/* for some sys/tmp columns also check 
for empty strings */
if (col.endsWith("name") || 
col.endsWith("keyword")
-|| "schema".equals(col) || 
"table".equals(col) || "column".equals(col) || "func".equals(col) || 
"mod".equals(col) || "statement".equals(col)
+|| "\"schema\"".equals(col) || 
"\"table\"".equals(col) || "\"column\"".equals(col)
+|| "func".equals(col) || 
"mod".equals(col) || "statement".equals(col)
 || ("type".equals(col) && 
("_columns".equals(tbl) || "args".equals(tbl) || "storage()".equals(tbl) || 
"storagemodelinput".equals(tbl {
isNullCond.append(" OR 
").append(col).append(" = ''");
}
@@ -987,11 +989,11 @@ public final class MDBvalidator {
{"db_user_info", "name", null},
{"statistics", "column_id", null},
 // old {"tracelog", "event", null},-- Error: Profiler not started. 
This table now (from Jun2020) contains only: ticks, stmt
-   {"\"storage\"()", "schema, table, column", null},   // the 
function "storage"() also lists the storage for system tables
-// {"storage", "schema, table, column", null}, // is a view on 
table producing function: sys.storage() which filters out all system tables.
-   {"storagemodelinput", "schema, table, column", null},
-// {"storagemodel", "schema, table, column", null},// is a 
view on storagemodelinput
-// {"tablestoragemodel", "schema, table", null},   // is a view on 
storagemodelinput
+   {"\"storage\"()", "\"schema\", \"table\", \"column\"", null},   
// the function "storage"() also lists the storage for system tables
+// {"\"storage\"", "\"schema\", \"table\", \"column\"", null}, 
// is a view on table producing function: sys.storage() which filters out all 
system tables.
+   {"storagemodelinput", "\"schema\", \"table\", \"column\"", 
null},
+// {"storagemodel", "\"schema\", \"table\", \"column\"", null},
// is a view on storagemodelinput
+// {"tablestoragemodel", "\"schema\", \"table\"", null},   // is a 
view on storagemodelinput
 
{"rejects", "rowid", "19"}, // querying this view caused 
problems in versions pre Jul2015, see 
https://github.com/MonetDB/MonetDB/issues/3794
 
@@ -1012,8 +1014,8 @@ public final class MDBvalidator {
{"var_values", "var_name", "29"},   // is a view
 
// new views introduced in Apr2019 feature release (11.33.3)
-// {"tablestorage", "schema, table", "33"},// is a view on 
view storage, see check on "storage"() above
-// {"schemastorage", "schema", "33"},  // is a view on view 
storage, see check on "storage"() above
+// {"tablestorage", "\"schema\", \"table\"", "33"},// is a 
view on view stora

MonetDB: default - Make compilable on CentOS 7.

2024-12-12 Thread Sjoerd Mullender via checkin-list
Changeset: 3c708e664682 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3c708e664682
Modified Files:
common/utils/mstring.h
Branch: default
Log Message:

Make compilable on CentOS 7.


diffs (12 lines):

diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -24,7 +24,7 @@
 #endif
 
 #if defined(__has_attribute)
-#if ! __has_attribute(access)
+#if ! __has_attribute(__access__)
 #define __access__(...)
 #endif
 #else
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: odbc_loader - merge with default

2024-12-12 Thread Martin van Dinther via checkin-list
Changeset: 71ba0fb7a1f3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/71ba0fb7a1f3
Modified Files:
clients/Tests/exports.stable.out
sql/common/sql_types.c
sql/server/rel_select.c
Branch: odbc_loader
Log Message:

merge with default


diffs (truncated from 11988 to 300 lines):

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
@@ -282,7 +282,7 @@ bool GDKexiting(void);
 jmp_buf GDKfataljump;
 bit GDKfataljumpenable;
 str GDKfatalmsg;
-char *GDKfilepath(int farmid, const char *dir, const char *nme, const char 
*ext);
+gdk_return GDKfilepath(char *buf, size_t bufsize, int farmid, const char *dir, 
const char *nme, const char *ext) __attribute__((__access__(write_only, 1, 2)));
 void GDKfree(void *blk);
 char *GDKgetbuf(void);
 unsigned GDKgetdebug(void);
@@ -301,7 +301,7 @@ MT_Lock *volatile GDKlocklist;
 ATOMIC_FLAG GDKlocklistlock;
 ATOMIC_TYPE GDKlocksleepcnt;
 void GDKlockstatistics(int);
-void *GDKmalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__alloc_size__(1))) __attribute__((__warn_unused_result__));
+void *GDKmalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__alloc_size__(1))) 
__attribute__((__warn_unused_result__));
 size_t GDKmallocated(const void *s);
 size_t GDKmem_cursize(void);
 gdk_return GDKmergeidx(BAT *b, BAT **a, int n_ar);
@@ -324,9 +324,9 @@ stream *GDKstdout;
 ssize_t GDKstrFromStr(unsigned char *restrict dst, const unsigned char 
*restrict src, ssize_t len, char quote);
 int GDKstrcasecmp(const char *s1, const char *s2);
 char *GDKstrcasestr(const char *haystack, const char *needle);
-str GDKstrdup(const char *s) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
+str GDKstrdup(const char *s) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
 int GDKstrncasecmp(const char *str1, const char *str2, size_t l1, size_t l2);
-str GDKstrndup(const char *s, size_t n) __attribute__((__malloc__)) 
__attribute__((__warn_unused_result__));
+str GDKstrndup(const char *s, size_t n) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__warn_unused_result__));
 gdk_return GDKtolower(char **restrict buf, size_t *restrict buflen, const char 
*restrict s) __attribute__((__access__(read_write, 1))) 
__attribute__((__access__(read_write, 2)));
 gdk_return GDKtoupper(char **restrict buf, size_t *restrict buflen, const char 
*restrict s) __attribute__((__access__(read_write, 1))) 
__attribute__((__access__(read_write, 2)));
 gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_level);
@@ -348,7 +348,7 @@ gdk_return GDKupgradevarheap(BAT *b, var
 lng GDKusec(void);
 const char *GDKversion(void) __attribute__((__const__));
 size_t GDKvm_cursize(void);
-void *GDKzalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__alloc_size__(1))) __attribute__((__warn_unused_result__));
+void *GDKzalloc(size_t size) __attribute__((__malloc__)) 
__attribute__((__malloc__(GDKfree, 1))) __attribute__((__alloc_size__(1))) 
__attribute__((__warn_unused_result__));
 void HASHdestroy(BAT *b);
 BUN HASHlist(Hash *h, BUN i);
 BUN HASHprobe(const Hash *h, const void *v);
@@ -527,15 +527,15 @@ int dlclose(void *handle);
 char *dlerror(void);
 void *dlopen(const char *file, int mode);
 void *dlsym(void *handle, const char *name);
-_Noreturn void eb_error(exception_buffer *eb, char *msg, int val);
+_Noreturn void eb_error(exception_buffer *eb, const char *msg, int val);
 exception_buffer *eb_init(exception_buffer *eb) 
__attribute__((__access__(write_only, 1)));
 size_t escapedStr(char *restrict dst, const char *restrict src, size_t dstlen, 
const char *sep1, const char *sep2, int quote);
 size_t escapedStrlen(const char *restrict src, const char *sep1, const char 
*sep2, int quote);
 ssize_t fltFromStr(const char *src, size_t *len, flt **dst, bool external);
 ssize_t fltToStr(str *dst, size_t *len, const flt *src, bool external);
 const flt flt_nil;
-gdk_return gdk_add_callback(char *name, gdk_callback_func *f, int argc, void 
*argv[], int interval);
-gdk_return gdk_remove_callback(char *, gdk_callback_func *f);
+gdk_return gdk_add_callback(const char *name, gdk_callback_func *f, int argc, 
void *argv[], int interval);
+gdk_return gdk_remove_callback(const char *, gdk_callback_func *f);
 bat getBBPsize(void);
 char *get_bin_path(void);
 int gettimeofday(struct timeval *tv, int *ignore_zone);
@@ -840,147 +840,147 @@ int UTF8_strwidth(const char *s);
 void addMalException(MalBlkPtr mb, str msg);
 str addOptimizerPipe(Client cntxt, MalBlkPtr mb, const char *name);
 str addPipeDefinition(Client cntxt, const char *name, const char *pipe);
-const char *affectedRowsRef;
-const char *aggrRef;
-const char *alarmRef;
-const char *algebraRef;
-const char *alter_add_range_partitionRef;
-const char *

MonetDB: default - Some more attributes.

2024-12-12 Thread Sjoerd Mullender via checkin-list
Changeset: 62eb0f527eb5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/62eb0f527eb5
Modified Files:
common/utils/mstring.h
gdk/gdk_private.h
sql/storage/bat/bat_logger.c
Branch: default
Log Message:

Some more attributes.


diffs (49 lines):

diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -73,6 +73,7 @@ GCC_Pragma("GCC diagnostic pop")
 /* copy the NULL terminated list of src strings with a maximum of n
  * bytes to dst; return the combined length of the src strings */
 __attribute__((__access__(write_only, 1, 2)))
+__attribute__((__sentinel__))
 static inline size_t
 strconcat_len(char *restrict dst, size_t n, const char *restrict src, ...)
 {
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -135,9 +135,13 @@ gdk_return GDKextendf(int fd, size_t siz
 int GDKfdlocate(int farmid, const char *nme, const char *mode, const char *ext)
__attribute__((__visibility__("hidden")));
 FILE *GDKfilelocate(int farmid, const char *nme, const char *mode, const char 
*ext)
-   __attribute__((__visibility__("hidden")));
+   __attribute__((__visibility__("hidden")))
+   __attribute__((__malloc__))
+   __attribute__((__malloc__(fclose, 1)));
 FILE *GDKfileopen(int farmid, const char *dir, const char *name, const char 
*extension, const char *mode)
-   __attribute__((__visibility__("hidden")));
+   __attribute__((__visibility__("hidden")))
+   __attribute__((__malloc__))
+   __attribute__((__malloc__(fclose, 1)));
 char *GDKload(int farmid, const char *nme, const char *ext, size_t size, 
size_t *maxsize, storage_t mode)
__attribute__((__visibility__("hidden")));
 gdk_return GDKmove(int farmid, const char *dir1, const char *nme1, const char 
*ext1, const char *dir2, const char *nme2, const char *ext2, bool report)
@@ -264,6 +268,7 @@ BAT *virtualize(BAT *bn)
 /* calculate the integer 2 logarithm (i.e. position of highest set
  * bit) of the argument (with a slight twist: 0 gives 0, 1 gives 1,
  * 0x8 to 0xF give 4, etc.) */
+__attribute__((__const__))
 static inline unsigned
 ilog2(BUN x)
 {
diff --git a/sql/storage/bat/bat_logger.c b/sql/storage/bat/bat_logger.c
--- a/sql/storage/bat/bat_logger.c
+++ b/sql/storage/bat/bat_logger.c
@@ -113,6 +113,7 @@ log_temp_descriptor(log_bid b)
 }
 
 #if defined CATALOG_JAN2022 || defined CATALOG_SEP2022
+/* cannot use attribute((sentinel)) since sentinel is not a pointer */
 static gdk_return
 tabins(logger *lg, ...)
 {
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


MonetDB: clean_parser - more cleanup, ie removed SQL_OP

2024-12-12 Thread Niels Nes via checkin-list
Changeset: 7e48a52696c1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7e48a52696c1
Modified Files:
sql/server/rel_select.c
sql/server/sql_parser.y
sql/server/sql_semantic.c
sql/server/sql_tokens.h
sql/test/cte/Tests/test_correlated_recursive_cte.test
Branch: clean_parser
Log Message:

more cleanup, ie removed SQL_OP


diffs (truncated from 541 to 300 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -787,7 +787,7 @@ rel_named_table_function(sql_query *quer
if (l->next->type == type_symbol)
n = l->next;
else
-   n = l->next->data.lval->h;
+   n = 
l->next->data.lval?l->next->data.lval->h:NULL;
 
for (dnode *m = n; m; m = m->next) {
if (m->type == type_symbol && 
m->data.sym->token == SQL_SELECT)
@@ -895,23 +895,6 @@ rel_named_table_function(sql_query *quer
return rel;
 }
 
-static sql_exp *
-rel_op_(mvc *sql, char *sname, char *fname, exp_kind ek)
-{
-   bool found = false;
-   sql_subfunc *f = NULL;
-   sql_ftype type = (ek.card == card_loader)?F_LOADER:((ek.card == 
card_none)?F_PROC:
-  ((ek.card == card_relation)?F_UNION:F_FUNC));
-
-   if ((f = bind_func_(sql, sname, fname, NULL, type, false, &found, 
true))) {
-   if (check_card(ek.card, f))
-   return exp_op(sql->sa, NULL, f);
-   found = false;
-   }
-   return sql_error(sql, ERR_NOTFOUND, SQLSTATE(42000) "SELECT: %s 
operator %s%s%s'%s'()",
-found ? "insufficient privileges for" 
: "no such", sname ? "'":"", sname ? sname : "", sname ? "'.":"", fname);
-}
-
 static sql_exp*
 exp_tuples_set_supertype(mvc *sql, list *tuple_values, sql_exp *tuples)
 {
@@ -3149,22 +3132,6 @@ rel_logical_exp(sql_query *query, sql_re
 static sql_exp * _rel_aggr(sql_query *query, sql_rel **rel, int distinct, char 
*sname, char *aname, dnode *arguments, int f);
 static sql_exp *rel_aggr(sql_query *query, sql_rel **rel, symbol *se, int f);
 
-static sql_exp *
-rel_op(sql_query *query, sql_rel **rel, symbol *se, int f, exp_kind ek )
-{
-   mvc *sql = query->sql;
-   dnode *l = se->data.lval->h;
-   char *fname = qname_schema_object(l->data.lval);
-   char *sname = qname_schema(l->data.lval);
-
-   if (find_func(sql, sname, fname, 1, F_AGGR, false, NULL, NULL))
-   return _rel_aggr(query, rel, 0, sname, fname, NULL, f);
-
-   sql->session->status = 0; /* if the function was not found clean the 
error */
-   sql->errstr[0] = '\0';
-   return rel_op_(sql, sname, fname, ek);
-}
-
 sql_exp *
 rel_unop_(mvc *sql, sql_rel *rel, sql_exp *e, char *sname, char *fname, int 
card)
 {
@@ -4928,9 +4895,6 @@ rel_rankop(sql_query *query, sql_rel **r
char *uaname = SA_NEW_ARRAY(sql->ta, char, strlen(aname) + 1);
return sql_error(sql, 02, SQLSTATE(42000) "%s: window functions 
cannot be nested", toUpperCopy(uaname, aname));
}
-   if (window_function->token == SQL_OP) {
-   window_function->token = SQL_NOP;
-   }
if (window_function->token == SQL_BINOP) {
window_function->token = SQL_NOP;
dn->next->next->type = type_list;
@@ -5260,8 +5224,6 @@ rel_value_exp2(sql_query *query, sql_rel
}
 
switch (se->token) {
-   case SQL_OP:
-   return rel_op(query, rel, se, f, ek);
case SQL_BINOP:
return rel_binop(query, rel, se, f, ek);
case SQL_NOP:
@@ -6460,7 +6422,7 @@ rel_loader_function(sql_query *query, sy
if (l->next->type == type_symbol)
n = l->next;
else
-   n = l->next->data.lval->h;
+   n = 
l->next->data.lval?l->next->data.lval->h:NULL;
 
for (dnode *m = n; m; m = m->next) {
if (m->type == type_symbol && 
m->data.sym->token == SQL_SELECT)
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
@@ -222,12 +222,10 @@ int yydebug=1;
like_predicate
like_table
literal
-   //map_funcs
merge_insert
merge_match_clause
merge_stmt
merge_update_or_delete
-   //multi_arg_func
null
object_name
operation
@@ -637,7 +635,6 @@ int yydebug=1;
 %token  XMLPARSE STRIP WHITESPACE XMLPI XMLQUERY PASSING XMLTEXT
 %token  NIL REF ABSENT EMPTY DOCUMENT ELEMENT CONTENT XMLNAMESPACES 
NAMESPACE
 %token  XMLVALIDATE RETURNING LOCATION ID ACCORDING XMLSCHEMA URI XMLAGG
-//%token  FIELD FILTER
 %token  FILTER
 %token  CORRESPONDING

MonetDB: clean_parser - allow comment on procedure analyze again

2024-12-12 Thread Niels Nes via checkin-list
Changeset: 42946980fa49 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/42946980fa49
Modified Files:
sql/server/sql_parser.y
Branch: clean_parser
Log Message:

allow comment on procedure analyze again


diffs (19 lines):

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
@@ -6171,6 +6171,7 @@ ident:
 
 non_reserved_keyword:
   AUTHORIZATION{ $$ = sa_strdup(SA, "authorization"); }/* sloppy: 
officially reserved */
+| ANALYZE  { $$ = sa_strdup(SA, "analyze"); }  /* sloppy: officially 
reserve */
 | CACHE{ $$ = sa_strdup(SA, "cache"); }
 | CYCLE{ $$ = sa_strdup(SA, "cycle"); }/* sloppy: 
officially reserved */
 | sqlDATE  { $$ = sa_strdup(SA, "date"); } /* sloppy: officially 
reserved */
@@ -6325,7 +6326,6 @@ function_name_keyword:
 
 reserved_keyword:
   ALL  { $$ = sa_strdup(SA, "all"); }
-| ANALYZE  { $$ = sa_strdup(SA, "analyze"); }
 | AND  { $$ = sa_strdup(SA, "and"); }
 | ANY  { $$ = sa_strdup(SA, "ANY"); }
 //| ARRAY  { $$ = sa_strdup(SA, "ARRAY"); }
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org


monetdb-java: default - When querying unique constraints metadat...

2024-12-12 Thread Martin van Dinther via checkin-list
Changeset: e9d65d746c80 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java/rev/e9d65d746c80
Modified Files:
src/main/java/org/monetdb/util/MDBvalidator.java
Branch: default
Log Message:

When querying unique constraints metadata include new type 3 (= Unique Key With 
Nulls Not Distinct).


diffs (21 lines):

diff --git a/src/main/java/org/monetdb/util/MDBvalidator.java 
b/src/main/java/org/monetdb/util/MDBvalidator.java
--- a/src/main/java/org/monetdb/util/MDBvalidator.java
+++ b/src/main/java/org/monetdb/util/MDBvalidator.java
@@ -278,7 +278,7 @@ public final class MDBvalidator {
// fetch the primary or unique key info from the MonetDB system 
tables
final StringBuilder sb = new StringBuilder(400);
sb.append(" FROM sys.keys k JOIN sys.tables t ON k.table_id = 
t.id JOIN sys.schemas s ON t.schema_id = s.id"
-   + " WHERE k.\"type\" = ").append(pkey ? 0 : 1)  
// 0 = primary keys, 1 = unique keys
+   + " WHERE k.\"type\" ").append(pkey ? "= 0" : 
"IN (1,3)")   // 0 = Primary Key, 1 = Unique Key, 3 = Unique Key With Nulls 
Not Distinct
.append(" and s.name = '").append(schema).append('\'');
String qry = sb.toString();
final int count = runCountQuery(qry);
@@ -291,7 +291,7 @@ public final class MDBvalidator {
// fetch the primary or unique key info including 
columns from the MonetDB system tables
sb.append("SELECT s.name as sch_nm, t.name as tbl_nm, 
k.name as key_nm, o.name as col_nm, o.nr")
.append(" FROM sys.keys k JOIN sys.objects o ON k.id = 
o.id JOIN sys.tables t ON k.table_id = t.id JOIN sys.schemas s ON t.schema_id = 
s.id"
-   + " WHERE k.\"type\" = ").append(pkey ? 0 : 1)  
// 0 = primary keys, 1 = unique keys
+   + " WHERE k.\"type\" ").append(pkey ? "= 0" : 
"IN (1,3)")   // 0 = Primary Key, 1 = Unique Key, 3 = Unique Key With Nulls 
Not Distinct
.append(" and s.name = '").append(schema).append('\'')
.append(" ORDER BY t.name, k.name, o.nr;");
qry = sb.toString();
___
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org