Changeset: 7680f040647f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7680f040647f
Modified Files:
        sql/backends/monet5/sql_result.c
        sql/backends/monet5/sql_upgrades.c
        sql/server/rel_optimize_proj.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 Sep2022 branch.


diffs (truncated from 3809 to 300 lines):

diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -590,6 +590,7 @@ mvc_import_table(Client cntxt, BAT ***ba
                                        BBPunfix(fmt[j].c->batCacheid);
                                }
                                GDKfree(fmt[i].data);
+                               GDKfree(fmt);
                                throw(IO, "sql.copy_from", SQLSTATE(HY013) 
MAL_MALLOC_FAIL);
                        }
                        fmt[i].c = NULL;
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
@@ -347,23 +347,23 @@ sql_drop_functions_dependencies_Xs_on_Ys
 
        /* remove functions which were created in 
sql/scripts/21_dependency_functions.sql */
        pos += snprintf(buf + pos, bufsize - pos,
-                       "DROP FUNCTION dependencies_schemas_on_users();\n"
-                       "DROP FUNCTION dependencies_owners_on_schemas();\n"
-                       "DROP FUNCTION dependencies_tables_on_views();\n"
-                       "DROP FUNCTION dependencies_tables_on_indexes();\n"
-                       "DROP FUNCTION dependencies_tables_on_triggers();\n"
-                       "DROP FUNCTION dependencies_tables_on_foreignKeys();\n"
-                       "DROP FUNCTION dependencies_tables_on_functions();\n"
-                       "DROP FUNCTION dependencies_columns_on_views();\n"
-                       "DROP FUNCTION dependencies_columns_on_keys();\n"
-                       "DROP FUNCTION dependencies_columns_on_indexes();\n"
-                       "DROP FUNCTION dependencies_columns_on_functions();\n"
-                       "DROP FUNCTION dependencies_columns_on_triggers();\n"
-                       "DROP FUNCTION dependencies_views_on_functions();\n"
-                       "DROP FUNCTION dependencies_views_on_triggers();\n"
-                       "DROP FUNCTION dependencies_functions_on_functions();\n"
-                       "DROP FUNCTION dependencies_functions_on_triggers();\n"
-                       "DROP FUNCTION dependencies_keys_on_foreignKeys();\n");
+                       "DROP FUNCTION dependencies_schemas_on_users() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_owners_on_schemas() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_tables_on_views() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_tables_on_indexes() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_tables_on_triggers() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_tables_on_foreignKeys() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_tables_on_functions() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_columns_on_views() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_columns_on_keys() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_columns_on_indexes() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_columns_on_functions() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_columns_on_triggers() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_views_on_functions() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_views_on_triggers() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_functions_on_functions() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_functions_on_triggers() 
CASCADE;\n"
+                       "DROP FUNCTION dependencies_keys_on_foreignKeys() 
CASCADE;\n");
 
        assert(pos < bufsize);
 
@@ -398,7 +398,7 @@ sql_update_storagemodel(Client c, mvc *s
        /* new 75_storagemodel.sql */
        pos += snprintf(buf + pos, bufsize - pos,
                /* drop objects in reverse order of original creation of old 
75_storagemodel.sql */
-               "drop view if exists sys.tablestoragemodel;\n"
+               "drop view if exists sys.tablestoragemodel cascade;\n"
                "drop view if exists sys.storagemodel cascade;\n"
                "drop function if exists sys.storagemodel() cascade;\n");
 
@@ -424,7 +424,7 @@ sql_update_storagemodel(Client c, mvc *s
        }
 
        pos += snprintf(buf + pos, bufsize - pos,
-               "drop procedure if exists sys.storagemodelinit();\n"
+               "drop procedure if exists sys.storagemodelinit() cascade;\n"
                "drop table if exists sys.storagemodelinput cascade;\n"
                "drop view if exists sys.\"storage\" cascade;\n");
 
@@ -946,23 +946,23 @@ sql_update_nov2019(Client c, mvc *sql)
 #endif
        /* 60/61_wlcr signatures migrations */
        pos += snprintf(buf + pos, bufsize - pos,
-                       "drop procedure master();\n"
-                       "drop procedure master(string);\n"
-                       "drop procedure stopmaster();\n"
-                       "drop procedure masterbeat(int);\n"
-                       "drop function masterClock();\n"
-                       "drop function masterTick();\n"
-                       "drop procedure replicate();\n"
-                       "drop procedure replicate(timestamp);\n"
-                       "drop procedure replicate(string);\n"
-                       "drop procedure replicate(string, timestamp);\n"
-                       "drop procedure replicate(string, tinyint);\n"
-                       "drop procedure replicate(string, smallint);\n"
-                       "drop procedure replicate(string, integer);\n"
-                       "drop procedure replicate(string, bigint);\n"
-                       "drop procedure replicabeat(integer);\n"
-                       "drop function replicaClock();\n"
-                       "drop function replicaTick();\n"
+                       "drop procedure master() cascade;\n"
+                       "drop procedure master(string) cascade;\n"
+                       "drop procedure stopmaster() cascade;\n"
+                       "drop procedure masterbeat(int) cascade;\n"
+                       "drop function masterClock() cascade;\n"
+                       "drop function masterTick() cascade;\n"
+                       "drop procedure replicate() cascade;\n"
+                       "drop procedure replicate(timestamp) cascade;\n"
+                       "drop procedure replicate(string) cascade;\n"
+                       "drop procedure replicate(string, timestamp) cascade;\n"
+                       "drop procedure replicate(string, tinyint) cascade;\n"
+                       "drop procedure replicate(string, smallint) cascade;\n"
+                       "drop procedure replicate(string, integer) cascade;\n"
+                       "drop procedure replicate(string, bigint) cascade;\n"
+                       "drop procedure replicabeat(integer) cascade;\n"
+                       "drop function replicaClock() cascade;\n"
+                       "drop function replicaTick() cascade;\n"
                );
 
        pos += snprintf(buf + pos, bufsize - pos,
@@ -1023,8 +1023,8 @@ sql_update_nov2019(Client c, mvc *sql)
 
        /* The MAL implementation of functions json.text(string) and 
json.text(int) do not exist */
        pos += snprintf(buf + pos, bufsize - pos,
-                       "drop function json.text(string);\n"
-                       "drop function json.text(int);\n");
+                       "drop function json.text(string) cascade;\n"
+                       "drop function json.text(int) cascade;\n");
 
        /* The first argument to copyfrom is a PTR type */
        pos += snprintf(buf + pos, bufsize - pos,
@@ -1094,7 +1094,7 @@ sql_update_jun2020(Client c, mvc *sql)
 
        /* 12_url */
        pos += snprintf(buf + pos, bufsize - pos,
-                       "drop function isaURL(url);\n"
+                       "drop function isaURL(url) cascade;\n"
                        "CREATE function isaURL(theUrl string) RETURNS BOOL\n"
                        " EXTERNAL NAME url.\"isaURL\";\n"
                        "GRANT EXECUTE ON FUNCTION isaURL(string) TO PUBLIC;\n"
@@ -1103,10 +1103,10 @@ sql_update_jun2020(Client c, mvc *sql)
 
        /* 13_date.sql */
        pos += snprintf(buf + pos, bufsize - pos,
-                       "drop function str_to_time(string, string);\n"
-                       "drop function time_to_str(time, string);\n"
-                       "drop function str_to_timestamp(string, string);\n"
-                       "drop function timestamp_to_str(timestamp, string);\n"
+                       "drop function str_to_time(string, string) cascade;\n"
+                       "drop function time_to_str(time, string) cascade;\n"
+                       "drop function str_to_timestamp(string, string) 
cascade;\n"
+                       "drop function timestamp_to_str(timestamp, string) 
cascade;\n"
                        "create function str_to_time(s string, format string) 
returns time with time zone\n"
                        " external name mtime.\"str_to_time\";\n"
                        "create function time_to_str(d time with time zone, 
format string) returns string\n"
@@ -1127,8 +1127,8 @@ sql_update_jun2020(Client c, mvc *sql)
        t = mvc_bind_table(sql, sys, "tracelog");
        t->system = 0; /* make it non-system else the drop view will fail */
        pos += snprintf(buf + pos, bufsize - pos,
-                       "drop view sys.tracelog;\n"
-                       "drop function sys.tracelog();\n"
+                       "drop view sys.tracelog cascade;\n"
+                       "drop function sys.tracelog() cascade;\n"
                        "create function sys.tracelog()\n"
                        " returns table (\n"
                        "  ticks bigint, -- time in microseconds\n"
@@ -1144,10 +1144,10 @@ sql_update_jun2020(Client c, mvc *sql)
 
        /* 17_temporal.sql */
        pos += snprintf(buf + pos, bufsize - pos,
-                       "drop function sys.epoch(bigint);\n"
-                       "drop function sys.epoch(int);\n"
-                       "drop function sys.epoch(timestamp);\n"
-                       "drop function sys.epoch(timestamp with time zone);\n"
+                       "drop function sys.epoch(bigint) cascade;\n"
+                       "drop function sys.epoch(int) cascade;\n"
+                       "drop function sys.epoch(timestamp) cascade;\n"
+                       "drop function sys.epoch(timestamp with time zone) 
cascade;\n"
                        "create function sys.epoch(sec BIGINT) returns 
TIMESTAMP WITH TIME ZONE\n"
                        " external name mtime.epoch;\n"
                        "create function sys.epoch(sec INT) returns TIMESTAMP 
WITH TIME ZONE\n"
@@ -1170,8 +1170,8 @@ sql_update_jun2020(Client c, mvc *sql)
        t->system = 0; /* make it non-system else the drop view will fail */
 
        pos += snprintf(buf + pos, bufsize - pos,
-                       "drop view sys.sessions;\n"
-                       "drop function sys.sessions;\n"
+                       "drop view sys.sessions cascade;\n"
+                       "drop function sys.sessions cascade;\n"
                        "create function sys.sessions()\n"
                        "returns table(\n"
                                "\"sessionid\" int,\n"
@@ -1285,8 +1285,8 @@ sql_update_jun2020(Client c, mvc *sql)
        t->system = 0; /* make it non-system else the drop view will fail */
 
        pos += snprintf(buf + pos, bufsize - pos,
-                       "drop view sys.queue;\n"
-                       "drop function sys.queue;\n"
+                       "drop view sys.queue cascade;\n"
+                       "drop function sys.queue cascade;\n"
                        "create function sys.queue()\n"
                        "returns table(\n"
                        "\"tag\" bigint,\n"
@@ -1303,9 +1303,9 @@ sql_update_jun2020(Client c, mvc *sql)
                        "create view sys.queue as select * from sys.queue();\n"
                        "grant select on sys.queue to public;\n"
 
-                       "drop procedure sys.pause(int);\n"
-                       "drop procedure sys.resume(int);\n"
-                       "drop procedure sys.stop(int);\n"
+                       "drop procedure sys.pause(int) cascade;\n"
+                       "drop procedure sys.resume(int) cascade;\n"
+                       "drop procedure sys.stop(int) cascade;\n"
 
                        "grant execute on procedure sys.pause(bigint) to 
public;\n"
                        "grant execute on procedure sys.resume(bigint) to 
public;\n"
@@ -1557,18 +1557,18 @@ sql_update_jun2020(Client c, mvc *sql)
                        " and schema_id = (select id from sys.schemas where 
name = 'sys') and type in (%d, %d);\n", (int) F_ANALYTIC, (int) F_AGGR);
 
        pos += snprintf(buf + pos, bufsize - pos,
-                       "DROP AGGREGATE stddev_samp(date);\n"
-                       "DROP AGGREGATE stddev_samp(time);\n"
-                       "DROP AGGREGATE stddev_samp(timestamp);\n"
-                       "DROP AGGREGATE stddev_pop(date);\n"
-                       "DROP AGGREGATE stddev_pop(time);\n"
-                       "DROP AGGREGATE stddev_pop(timestamp);\n"
-                       "DROP AGGREGATE var_samp(date);\n"
-                       "DROP AGGREGATE var_samp(time);\n"
-                       "DROP AGGREGATE var_samp(timestamp);\n"
-                       "DROP AGGREGATE var_pop(date);\n"
-                       "DROP AGGREGATE var_pop(time);\n"
-                       "DROP AGGREGATE var_pop(timestamp);\n");
+                       "DROP AGGREGATE stddev_samp(date) CASCADE;\n"
+                       "DROP AGGREGATE stddev_samp(time) CASCADE;\n"
+                       "DROP AGGREGATE stddev_samp(timestamp) CASCADE;\n"
+                       "DROP AGGREGATE stddev_pop(date) CASCADE;\n"
+                       "DROP AGGREGATE stddev_pop(time) CASCADE;\n"
+                       "DROP AGGREGATE stddev_pop(timestamp) CASCADE;\n"
+                       "DROP AGGREGATE var_samp(date) CASCADE;\n"
+                       "DROP AGGREGATE var_samp(time) CASCADE;\n"
+                       "DROP AGGREGATE var_samp(timestamp) CASCADE;\n"
+                       "DROP AGGREGATE var_pop(date) CASCADE;\n"
+                       "DROP AGGREGATE var_pop(time) CASCADE;\n"
+                       "DROP AGGREGATE var_pop(timestamp) CASCADE;\n");
 
        /* 51_sys_schema_extensions */
        pos += snprintf(buf + pos, bufsize - pos,
@@ -1695,27 +1695,27 @@ sql_update_jun2020_bam(Client c, mvc *m)
        pos += snprintf(buf + pos, bufsize - pos,
                        "update sys.schemas set system = false where name = 
'bam';\n"
                        "update sys._tables set system = false where schema_id 
in (select id from sys.schemas where name = 'bam');\n"
-                       "drop procedure bam.bam_loader_repos;\n"
-                       "drop procedure bam.bam_loader_files;\n"
-                       "drop procedure bam.bam_loader_file;\n"
-                       "drop procedure bam.bam_drop_file;\n"
-                       "drop function bam.bam_flag;\n"
-                       "drop function bam.reverse_seq;\n"
-                       "drop function bam.reverse_qual;\n"
-                       "drop function bam.seq_length;\n"
-                       "drop function bam.seq_char;\n"
-                       "drop procedure bam.sam_export;\n"
-                       "drop procedure bam.bam_export;\n");
+                       "drop procedure bam.bam_loader_repos cascade;\n"
+                       "drop procedure bam.bam_loader_files cascade;\n"
+                       "drop procedure bam.bam_loader_file cascade;\n"
+                       "drop procedure bam.bam_drop_file cascade;\n"
+                       "drop function bam.bam_flag cascade;\n"
+                       "drop function bam.reverse_seq cascade;\n"
+                       "drop function bam.reverse_qual cascade;\n"
+                       "drop function bam.seq_length cascade;\n"
+                       "drop function bam.seq_char cascade;\n"
+                       "drop procedure bam.sam_export cascade;\n"
+                       "drop procedure bam.bam_export cascade;\n");
        if (b) {
                if (BATcount(b) > 0 && *(lng *) Tloc(b, 0) == 0) {
                        /* tables in bam schema are empty: drop them */
                        pos += snprintf(buf + pos, bufsize - pos,
-                                       "drop table bam.sq;\n"
-                                       "drop table bam.rg;\n"
-                                       "drop table bam.pg;\n"
-                                       "drop table bam.export;\n"
-                                       "drop table bam.files;\n"
-                                       "drop schema bam;\n");
+                                       "drop table bam.sq cascade;\n"
+                                       "drop table bam.rg cascade;\n"
+                                       "drop table bam.pg cascade;\n"
+                                       "drop table bam.export cascade;\n"
+                                       "drop table bam.files cascade;\n"
+                                       "drop schema bam cascade;\n");
                }
                BBPunfix(b->batCacheid);
        }
@@ -1788,9 +1788,9 @@ static str
 sql_update_oscar_lidar(Client c)
 {
        char *query =
-               "drop procedure sys.lidarattach(string);\n"
-               "drop procedure sys.lidarload(string);\n"
-               "drop procedure sys.lidarexport(string, string, string);\n";
+               "drop procedure sys.lidarattach(string) cascade;\n"
+               "drop procedure sys.lidarload(string) cascade;\n"
+               "drop procedure sys.lidarexport(string, string, string) 
cascade;\n";
        printf("Running database upgrade commands:\n%s\n", query);
        return SQLstatementIntern(c, query, "update", true, false, NULL);
 }
@@ -1838,8 +1838,8 @@ sql_update_oscar(Client c, mvc *sql)
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to