Changeset: 7c24be654633 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/7c24be654633 Modified Files: sql/backends/monet5/sql_upgrades.c Branch: cleanup_types Log Message:
merged with default diffs (truncated from 392 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 @@ -6561,6 +6561,39 @@ sql_update_dec2023(Client c, mvc *sql, s return err; } +static str +sql_update_dec2023_sp1(Client c, mvc *sql, sql_schema *s) +{ + char *err; + res_table *output; + BAT *b; + + (void) sql; + (void) s; + + /* json.isvalid(json) has been fixed to return NULL on NULL input */ + err = SQLstatementIntern(c, "SELECT f.id FROM sys.functions f WHERE f.name = 'isvalid' AND f.schema_id = (SELECT s.id FROM sys.schemas s WHERE s.name = 'json') AND EXISTS (SELECT * FROM sys.args a WHERE a.func_id = f.id AND a.number = 1 AND a.type = 'json') AND f.func LIKE '%begin return true%';\n", "update", true, false, &output); + if (err) + return err; + b = BATdescriptor(output->cols[0].b); + if (b) { + if (BATcount(b) > 0) { + const char *query = "drop function json.isvalid(json);\n" + "create function json.isvalid(js json)\n" + "returns bool begin return case when js is NULL then NULL else true end; end;\n" + "GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC;\n" + "update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json');\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; +} + int SQLupgrades(Client c, mvc *m) { @@ -6739,15 +6772,19 @@ SQLupgrades(Client c, mvc *m) goto handle_error; } + if ((err = sql_update_jun2023_sp3(c, m, s)) != NULL) { + TRC_CRITICAL(SQL_PARSER, "%s\n", err); + goto handle_error; + } + if ((err = sql_update_dec2023(c, m, s)) != NULL) { TRC_CRITICAL(SQL_PARSER, "%s\n", err); goto handle_error; } - if ((err = sql_update_jun2023_sp3(c, m, s)) != NULL) { + if ((err = sql_update_dec2023_sp1(c, m, s)) != NULL) { TRC_CRITICAL(SQL_PARSER, "%s\n", err); - freeException(err); - return -1; + goto handle_error; } return 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 @@ -603,3 +603,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -603,3 +603,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -672,3 +672,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -603,3 +603,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -603,3 +603,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -672,3 +672,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -0,0 +1,7 @@ +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -0,0 +1,7 @@ +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -69,3 +69,10 @@ update sys.functions set system = true w update sys.functions set system = true where system <> true and name in ('stddev_samp', 'stddev_pop', 'var_samp', 'covar_samp', 'var_pop', 'covar_pop', 'corr') and schema_id = (select id from sys.schemas where name = 'sys') and type = 6; 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: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 @@ -69,3 +69,10 @@ update sys.functions set system = true w update sys.functions set system = true where system <> true and name in ('stddev_samp', 'stddev_pop', 'var_samp', 'covar_samp', 'var_pop', 'covar_pop', 'corr') and schema_id = (select id from sys.schemas where name = 'sys') and type = 6; 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: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -0,0 +1,7 @@ +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -0,0 +1,7 @@ +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + 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 @@ -69,3 +69,10 @@ update sys.functions set system = true w update sys.functions set system = true where system <> true and name in ('stddev_samp', 'stddev_pop', 'var_samp', 'covar_samp', 'var_pop', 'covar_pop', 'corr') and schema_id = (select id from sys.schemas where name = 'sys') and type = 6; 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: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + diff --git a/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 b/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 --- a/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 +++ b/sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 @@ -603,3 +603,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + diff --git a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out --- a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out +++ b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out @@ -603,3 +603,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + diff --git a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 --- a/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 +++ b/sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 @@ -672,3 +672,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + diff --git a/sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128 b/sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128 --- a/sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128 +++ b/sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128 @@ -603,3 +603,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: +drop function json.isvalid(json); +create function json.isvalid(js json) +returns bool begin return case when js is NULL then NULL else true end; end; +GRANT EXECUTE ON FUNCTION json.isvalid(json) TO PUBLIC; +update sys.functions set system = true where system <> true and name = 'isvalid' and schema_id = (select id from sys.schemas where name = 'json'); + diff --git a/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out b/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out --- a/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out +++ b/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out @@ -603,3 +603,10 @@ GRANT EXECUTE ON FUNCTION sys.persist_un UPDATE sys.functions SET system = true WHERE system <> true AND name = 'persist_unlogged' AND schema_id = 2000 AND type = 5 AND language = 1; +Running database upgrade commands: _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org