Changeset: b9a66dd5eb38 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b9a66dd5eb38
Modified Files:
sql/backends/monet5/sql_upgrades.c
sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/emptydb-upgrade/Tests/upgrade.stable.out
sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
sql/test/testdb-upgrade/Tests/upgrade.stable.out
sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: default
Log Message:
Merge with Dec2025 branch.
diffs (truncated from 437 to 300 lines):
diff --git a/sql/backends/monet5/sql_upgrades.c
b/sql/backends/monet5/sql_upgrades.c
--- a/sql/backends/monet5/sql_upgrades.c
+++ b/sql/backends/monet5/sql_upgrades.c
@@ -375,6 +375,16 @@ sql_drop_shp(Client c)
return SQLstatementIntern(c, query, "update", true, false, NULL);
}
+
+static str
+sql_update_generator(Client c)
+{
+ static const char query[] =
+ "update sys.args set name = 'limit' where name = 'last' and
func_id in (select id from sys.functions where schema_id = 2000 and name =
'generate_series' and func like '% last %');\n"
+ "update sys.functions set func = replace(func, ' last ', '
\"limit\" ') where schema_id = 2000 and name = 'generate_series' and func like
'% last %';\n";
+ return SQLstatementIntern(c, query, "update", true, false, NULL);
+}
+
static str
sql_update_jan2022(Client c, mvc *sql)
{
@@ -5333,6 +5343,37 @@ sql_update_dec2025_sp1(Client c, mvc *sq
}
static str
+sql_update_dec2025_sp2(Client c, mvc *sql, sql_schema *s)
+{
+ char *err;
+ res_table *output;
+ BAT *b;
+
+ (void) sql;
+ (void) s;
+
+ /* better optimizers recognize that what before was seen as a
+ * dependency in fact wasn't */
+ err = SQLstatementIntern(c, "select * from sys.dependencies where (id,
depend_id) in (select c.id, f.id from sys.functions f, sys._tables t,
sys._columns c, sys.dependencies d where c.table_id = t.id and f.id =
d.depend_id and c.id = d.id and f.schema_id = 2000 and t.schema_id = 2000 and
(f.name, t.name, c.name) in (values ('get_merge_table_partition_expressions',
'table_partitions', 'id')));\n", "update", true, false, &output);
+ if (err)
+ return err;
+ b = BATdescriptor(output->cols[0].b);
+ if (b) {
+ if (BATcount(b) > 0) {
+ static const char query[] =
+ "delete from sys.dependencies where (id,
depend_id) in (select c.id, f.id from sys.functions f, sys._tables t,
sys._columns c, sys.dependencies d where c.table_id = t.id and f.id =
d.depend_id and c.id = d.id and f.schema_id = 2000 and t.schema_id = 2000 and
(f.name, t.name, c.name) in (values ('get_merge_table_partition_expressions',
'table_partitions', 'id')));\n";
+ assert(BATcount(b) == 1);
+ printf("Running database upgrade commands:\n%s\n",
query);
+ fflush(stdout);
+ err = SQLstatementIntern(c, query, "update", true,
false, NULL);
+ }
+ BBPunfix(b->batCacheid);
+ }
+ res_table_destroy(output);
+ return err;
+}
+
+static str
sql_update_default(Client c, mvc *sql, sql_schema *s)
{
char *err;
@@ -5342,26 +5383,6 @@ sql_update_default(Client c, mvc *sql, s
(void) sql;
(void) s;
- /* 2048 is id of column sys.table_partitions.id */
- err = SQLstatementIntern(c, "select * from sys.dependencies where id =
2048 and depend_id = (select f.id from sys.functions f where name =
'get_merge_table_partition_expressions');\n", "update", true, false, &output);
- if (err)
- return err;
- b = BATdescriptor(output->cols[0].b);
- if (b != NULL) {
- if (BATcount(b) != 0) {
- const char query[] =
- "delete from sys.dependencies where id = 2048
and depend_id = (select f.id from sys.functions f where name =
'get_merge_table_partition_expressions');\n";
- printf("Running database upgrade commands:\n%s\n",
query);
- fflush(stdout);
- err = SQLstatementIntern(c, query, "update", true,
false, NULL);
- }
- BBPreclaim(b);
- }
- res_table_destroy(output);
-
- if (err)
- return err;
-
err = SQLstatementIntern(c, "select id from sys._tables where name =
'describe_tables' and schema_id = 2000 and query like '%''false''%';\n",
"update", true, false, &output);
if (err)
return err;
@@ -5492,6 +5513,10 @@ SQLupgrades(Client c, mvc *m)
}
#endif
+ if ((err = sql_update_generator(c)) != NULL) {
+ goto handle_error;
+ }
+
if ((err = sql_update_jan2022(c, m)) != NULL) {
goto handle_error;
}
@@ -5558,6 +5583,11 @@ SQLupgrades(Client c, mvc *m)
goto handle_error;
}
+ if ((err = sql_update_dec2025_sp2(c, m, s)) != NULL) {
+ TRC_CRITICAL(SQL_PARSER, "%s\n", err);
+ goto handle_error;
+ }
+
if ((err = sql_update_default(c, m, s)) != NULL) {
TRC_CRITICAL(SQL_PARSER, "%s\n", err);
goto handle_error;
diff --git a/sql/test/BugTracker-2026/Tests/7857-rollup-crash.test
b/sql/test/BugTracker-2026/Tests/7857-rollup-crash.test
--- a/sql/test/BugTracker-2026/Tests/7857-rollup-crash.test
+++ b/sql/test/BugTracker-2026/Tests/7857-rollup-crash.test
@@ -1,2 +1,2 @@
-statement error 22018!conversion of string 'x' to type bte failed.
+statement error 22018!conversion of string ...
SELECT * FROM ( SELECT * FROM ( SELECT 1 AS x ) WHERE x IN ( SELECT ALL
sql_min ( NULL , NULL ) FROM ( SELECT * FROM ( WITH x AS ( SELECT 1 ) SELECT (
SELECT CASE WHEN NOT NULL THEN 4 * - 48 * 51 * - - 54 * - 77 * 46 WHEN NOT (
NULL ) IN ( - ( - - 49 ) * - 1 , - 41 , - 14 % - CASE - - 1 WHEN - - 82 THEN -
22 ^ COUNT ( * ) END / 46 - - 87 * 52 ) THEN 56 ELSE NULL END FROM ( SELECT SUM
( 0 ) OVER ( ORDER BY SUM ( '$.f2' BETWEEN 1 AND 1 ) ) FROM x GROUP BY rollup (
x , x ) ORDER BY x , x , x ) , ( SELECT x AS x ) WHERE x = 'x' ) , 'x' FROM x )
WHERE ( x % 7 ) = 0 ) ) )
diff --git
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
---
a/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++
b/sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -279,7 +279,7 @@ GRANT SELECT ON sys.describe_accessible_
UPDATE sys._tables SET system = true WHERE not system and schema_id = 2000 and
name in ('roles', 'describe_accessible_tables');
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
@@ -279,7 +279,7 @@ GRANT SELECT ON sys.describe_accessible_
UPDATE sys._tables SET system = true WHERE not system and schema_id = 2000 and
name in ('roles', 'describe_accessible_tables');
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git
a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128
@@ -364,7 +364,7 @@ GRANT SELECT ON sys.describe_accessible_
UPDATE sys._tables SET system = true WHERE not system and schema_id = 2000 and
name in ('roles', 'describe_accessible_tables');
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git
a/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128
@@ -281,7 +281,7 @@ GRANT SELECT ON sys.describe_accessible_
UPDATE sys._tables SET system = true WHERE not system and schema_id = 2000 and
name in ('roles', 'describe_accessible_tables');
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
--- a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
@@ -281,7 +281,7 @@ GRANT SELECT ON sys.describe_accessible_
UPDATE sys._tables SET system = true WHERE not system and schema_id = 2000 and
name in ('roles', 'describe_accessible_tables');
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128
@@ -364,7 +364,7 @@ GRANT SELECT ON sys.describe_accessible_
UPDATE sys._tables SET system = true WHERE not system and schema_id = 2000 and
name in ('roles', 'describe_accessible_tables');
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -1,5 +1,5 @@
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
@@ -1,5 +1,5 @@
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
@@ -84,7 +84,7 @@ update sys.functions set system = true w
update sys.functions set system = true where system <> true and name =
'filter' and schema_id = (select id from sys.schemas where name = 'json') and
type = 1;
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git a/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
@@ -1,5 +1,5 @@
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
--- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out
@@ -1,5 +1,5 @@
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
--- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
+++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
@@ -84,7 +84,7 @@ update sys.functions set system = true w
update sys.functions set system = true where system <> true and name =
'filter' and schema_id = (select id from sys.schemas where name = 'json') and
type = 1;
Running database upgrade commands:
-delete from sys.dependencies where id = 2048 and depend_id = (select f.id from
sys.functions f where name = 'get_merge_table_partition_expressions');
+delete from sys.dependencies where (id, depend_id) in (select c.id, f.id from
sys.functions f, sys._tables t, sys._columns c, sys.dependencies d where
c.table_id = t.id and f.id = d.depend_id and c.id = d.id and f.schema_id = 2000
and t.schema_id = 2000 and (f.name, t.name, c.name) in (values
('get_merge_table_partition_expressions', 'table_partitions', 'id')));
Running database upgrade commands:
drop function sys.dump_database;
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
@@ -11,6 +11,8 @@ user = 'monetdb'
passwd = 'monetdb'
approve = None
check = None
+stableout = 'check.stable.out.32bit' if os.getenv('TST_BITS', '') == '32bit'
else 'check.stable.out.int128' if os.getenv('HAVE_HGE') else 'check.stable.out'
+
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser(description='Run check queries on a
database')
@@ -24,11 +26,17 @@ if __name__ == '__main__':
help='user name to login to the database with')
parser.add_argument('--password', action='store', default=passwd,
help='password to use to login to the database with')
- parser.add_argument('--approve', action='store', default=approve,
+ xgroup = parser.add_argument_group(title='at most one of these')
+ rgroup = xgroup.add_mutually_exclusive_group()
+ rgroup.add_argument('--approve', action='store', default=approve,
type=argparse.FileType('w'),
help='file in which to produce a new .test file '
'with updated results')
- parser.add_argument('check', nargs='*', help='name of test')
+ rgroup.add_argument('--stableout', action='store', default=None,
+ help='stable output to compare against '
+ '(implies check mode)')
+ parser.add_argument('check', nargs='*', help='name of test '
+ '(implies check mode, ignored if --approve)')
opts = parser.parse_args()
port = opts.port
dbname = opts.database
@@ -37,6 +45,9 @@ if __name__ == '__main__':
passwd = opts.password
approve = opts.approve
check = opts.check
+ if opts.stableout is not None:
+ stableout = opts.stableout
+ check = True
xit = 0
output = []
@@ -586,7 +597,6 @@ with process.client('sql', interactive=T
if check:
output = ''.join(output).splitlines(keepends=True)
- stableout = 'check.stable.out.32bit' if os.getenv('TST_BITS', '') ==
'32bit' else 'check.stable.out.int128' if os.getenv('HAVE_HGE') else
'check.stable.out'
with open(stableout) as fil:
stable = fil.readlines()
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]