Changeset: 626a06b4c450 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/626a06b4c450
Branch: Dec2023
Log Message:

merged


diffs (truncated from 388 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -826,3 +826,4 @@ dcc8c702e685a4faf21ccf663028d1bc3d1165d1
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_7
 d656785f49ee62c19705722aa6b7c171904c64d5 Dec2023_SP2_release
 9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_9
+9a694c41042503a22d6c92aeab5bc4ca1912b62e Dec2023_SP3_release
diff --git a/gdk/gdk_calc_convert.c b/gdk/gdk_calc_convert.c
--- a/gdk/gdk_calc_convert.c
+++ b/gdk/gdk_calc_convert.c
@@ -865,6 +865,7 @@ convert_str_fix(BATiter *bi, int tp, voi
                return 0;
        }
 
+       int (*atomcmp)(const void *, const void *) = ATOMcompare(tp);
        TIMEOUT_LOOP(ci->ncand, timeoffset) {
                oid x = canditer_next(ci) - candoff;
                const char *s = BUNtvar(*bi, x);
@@ -878,7 +879,7 @@ convert_str_fix(BATiter *bi, int tp, voi
                                goto conversion_failed;
                        }
                        assert(len == ATOMsize(tp));
-                       if (ATOMcmp(tp, dst, nil) == 0)
+                       if (atomcmp(dst, nil) == 0)
                                nils++;
                }
                dst = (void *) ((char *) dst + len);
diff --git a/gdk/gdk_hash.c b/gdk/gdk_hash.c
--- a/gdk/gdk_hash.c
+++ b/gdk/gdk_hash.c
@@ -899,7 +899,8 @@ BAThash_impl(BAT *restrict b, struct can
                case TYPE_uuid:
                        starthash(uuid);
                        break;
-               default:
+               default: {
+                       int (*atomcmp)(const void *, const void *) = 
ATOMcompare(h->type);
                        TIMEOUT_LOOP(p, timeoffset) {
                                const void *restrict v = BUNtail(bi, o - 
b->hseqbase);
                                c = hash_any(h, v);
@@ -913,8 +914,7 @@ BAThash_impl(BAT *restrict b, struct can
                                        for (hb = hget;
                                             hb != BUN_NONE;
                                             hb = HASHgetlink(h, hb)) {
-                                               if (ATOMcmp(h->type,
-                                                           v,
+                                               if (atomcmp(v,
                                                            BUNtail(bi, hb)) == 
0)
                                                        break;
                                        }
@@ -928,6 +928,7 @@ BAThash_impl(BAT *restrict b, struct can
                                      GOTO_LABEL_TIMEOUT_HANDLER(bailout));
                        break;
                }
+               }
                TRC_DEBUG_IF(ACCELERATOR) if (p < cnt1)
                        TRC_DEBUG_ENDIF(ACCELERATOR,
                                        "%s: abort starthash with "
@@ -975,7 +976,8 @@ BAThash_impl(BAT *restrict b, struct can
        case TYPE_uuid:
                finishhash(uuid);
                break;
-       default:
+       default: {
+               int (*atomcmp)(const void *, const void *) = 
ATOMcompare(h->type);
                TIMEOUT_LOOP(ci->ncand - p, timeoffset) {
                        const void *restrict v = BUNtail(bi, o - b->hseqbase);
                        c = hash_any(h, v);
@@ -985,7 +987,7 @@ BAThash_impl(BAT *restrict b, struct can
                                for (hb = hget;
                                     hb != BUN_NONE;
                                     hb = HASHgetlink(h, hb)) {
-                                       if (ATOMcmp(h->type, v, BUNtail(bi, 
hb)) == 0)
+                                       if (atomcmp(v, BUNtail(bi, hb)) == 0)
                                                break;
                                }
                                h->nunique += hb == BUN_NONE;
@@ -999,6 +1001,7 @@ BAThash_impl(BAT *restrict b, struct can
                              GOTO_LABEL_TIMEOUT_HANDLER(bailout));
                break;
        }
+       }
        bat_iterator_end(&bi);
        /* if the number of unique values is equal to the bat count,
         * all values are necessarily distinct */
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
@@ -6594,6 +6594,46 @@ sql_update_dec2023_sp1(Client c, mvc *sq
        return err;
 }
 
+static str
+sql_update_dec2023_sp4(Client c, mvc *sql, sql_schema *s)
+{
+       char *err;
+       res_table *output;
+       BAT *b;
+
+       (void) sql;
+       (void) s;
+
+       /* SQL optimizer fixes make that some "dependencies" are no longer
+        * dependencies (functions that depend on all columns of a table
+        * when it only actually uses a subset of the columns); while we're
+        * at it, also fix some ancient dependency changes where view did
+        * the same thing (i.e. the second delete will normally not delete
+        * anything) */
+       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 ('describe_columns', '_columns', 
'storage')));\n", "update", true, false, &output);
+       if (err)
+               return err;
+       b = BATdescriptor(output->cols[0].b);
+       if (b) {
+               if (BATcount(b) > 0) {
+                       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 ('describe_columns', '_columns', 
'storage'), ('describe_function', 'function_languages', 'language_name'), 
('describe_function', 'function_types', 'function_type_name'), 
('describe_function', 'functions', 'func'), ('describe_function', 'functions', 
'mod'), ('describe_function', 'functions', 'semantics'), ('describe_function', 
'functions', 'side_effect'), ('describe_function', 'functions', 'system'), 
('describe_function', 'functions', 'vararg'), ('describe_function', 
'functions', 'varres'), ('describe_function', 'schemas', 'authorization'), 
('describe_function', 'schemas', 'owner'), ('describe_function', 'schemas', 
'system'), ('describe_table', '_tables', 'access'), ('de
 scribe_table', '_tables', 'commit_action'), ('describe_table', '_tables', 
'system')));\n"
+                               "delete from sys.dependencies where (id, 
depend_id) in (select c.id, v.id from sys._tables v, sys._tables t, 
sys._columns c, sys.dependencies d where c.table_id = t.id and v.id = 
d.depend_id and c.id = d.id and v.schema_id = 2000 and t.schema_id = 2000 and 
(v.name, t.name, c.name) in (values ('dependency_columns_on_indexes', 
'_columns', 'name'), ('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), ('dependency_columns_
 on_keys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_fore
 ignkeys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys'
 , 'type')));\n"
+                               /* the "chain" upgrade check tests fail with a 
duplicate
+                                * entry in sys.dependencies, but running this 
query
+                                * results in NULL values in sys.dependencies 
in some of
+                                * the upgrade tests, so it is disabled */
+                               /*"create temporary table d as (select distinct 
* from sys.dependencies);\ndelete from sys.dependencies;\ninsert into 
sys.dependencies (select * from d);\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)
 {
@@ -6787,6 +6827,11 @@ SQLupgrades(Client c, mvc *m)
                goto handle_error;
        }
 
+       if ((err = sql_update_dec2023_sp4(c, m, s)) != NULL) {
+               TRC_CRITICAL(SQL_PARSER, "%s\n", err);
+               goto handle_error;
+       }
+
        return 0;
 
 handle_error:
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
@@ -610,3 +610,7 @@ returns bool begin return case when js i
 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');
 
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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
@@ -610,3 +610,7 @@ returns bool begin return case when js i
 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');
 
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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
@@ -679,3 +679,7 @@ returns bool begin return case when js i
 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');
 
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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
@@ -610,3 +610,7 @@ returns bool begin return case when js i
 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');
 
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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
@@ -610,3 +610,7 @@ returns bool begin return case when js i
 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');
 
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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
@@ -679,3 +679,7 @@ returns bool begin return case when js i
 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');
 
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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,4 @@
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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,4 @@
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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,7 @@ 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:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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,4 @@
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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,4 @@
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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,7 @@ 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:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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
@@ -610,3 +610,7 @@ returns bool begin return case when js i
 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');
 
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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
@@ -610,3 +610,7 @@ returns bool begin return case when js i
 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');
 
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
+
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
@@ -679,3 +679,7 @@ returns bool begin return case when js i
 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');
 
+Running database upgrade commands:
+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 
('describe_columns', '_columns', 'storage'), ('describe_function', 
'function_languages', 'language_name'), ('describe_function', 'function_types', 
'function_type_name'), ('describe_function', 'functions', 'func'), 
('describe_function', 'functions', 'mod'), ('describe_function', 'functions', 
'semantics'), ('describe_function', 'functions', 'side_effect'), 
('describe_function', 'functions', 'system'), ('describe_function', 
'functions', 'vararg'), ('describe_function', 'functions', 'varres'), 
('describe_function', 'schemas', 'authorization'), ('describe_function', 
'schemas', 'owner'), ('describe_function', 'schemas', 'system'), 
('describe_table', '_tables', 'access'), ('describe_table', '_tables',
  'commit_action'), ('describe_table', '_tables', 'system')));
+delete from sys.dependencies where (id, depend_id) in (select c.id, v.id from 
sys._tables v, sys._tables t, sys._columns c, sys.dependencies d where 
c.table_id = t.id and v.id = d.depend_id and c.id = d.id and v.schema_id = 2000 
and t.schema_id = 2000 and (v.name, t.name, c.name) in (values 
('dependency_columns_on_indexes', '_columns', 'name'), 
('dependency_columns_on_indexes', '_columns', 'number'), 
('dependency_columns_on_indexes', '_columns', 'storage'), 
('dependency_columns_on_indexes', '_columns', 'table_id'), 
('dependency_columns_on_indexes', '_columns', 'type_digits'), 
('dependency_columns_on_indexes', 'keys', 'id'), 
('dependency_columns_on_indexes', 'triggers', 'name'), 
('dependency_columns_on_indexes', 'triggers', 'orientation'), 
('dependency_columns_on_indexes', 'triggers', 'table_id'), 
('dependency_columns_on_indexes', 'triggers', 'time'), 
('dependency_columns_on_keys', '_columns', 'name'), 
('dependency_columns_on_keys', '_columns', 'table_id'), 
('dependency_columns_on_ke
 ys', '_columns', 'type'), ('dependency_columns_on_keys', '_columns', 
'type_digits'), ('dependency_columns_on_keys', '_columns', 'type_scale'), 
('dependency_columns_on_keys', 'triggers', 'name'), 
('dependency_columns_on_keys', 'triggers', 'orientation'), 
('dependency_columns_on_keys', 'triggers', 'table_id'), 
('dependency_columns_on_keys', 'triggers', 'time'), 
('dependency_columns_on_triggers', 'keys', 'name'), 
('dependency_columns_on_triggers', 'keys', 'rkey'), 
('dependency_columns_on_triggers', 'keys', 'type'), 
('dependency_functions_on_triggers', 'keys', 'action'), 
('dependency_functions_on_triggers', 'keys', 'name'), 
('dependency_functions_on_triggers', 'keys', 'rkey'), 
('dependency_functions_on_triggers', 'keys', 'type'), 
('dependency_keys_on_foreignkeys', '_columns', 'default'), 
('dependency_keys_on_foreignkeys', '_columns', 'name'), 
('dependency_keys_on_foreignkeys', '_columns', 'table_id'), 
('dependency_keys_on_foreignkeys', '_columns', 'type'), 
('dependency_keys_on_foreignke
 ys', '_columns', 'type_digits'), ('dependency_keys_on_foreignkeys', 
'_columns', 'type_scale'), ('dependency_tables_on_foreignkeys', '_columns', 
'default'), ('dependency_tables_on_foreignkeys', '_columns', 'name'), 
('dependency_tables_on_foreignkeys', '_columns', 'table_id'), 
('dependency_tables_on_foreignkeys', '_columns', 'type'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_digits'), 
('dependency_tables_on_foreignkeys', '_columns', 'type_scale'), 
('dependency_tables_on_indexes', '_columns', 'name'), 
('dependency_tables_on_indexes', '_columns', 'number'), 
('dependency_tables_on_indexes', '_columns', 'storage'), 
('dependency_tables_on_indexes', '_columns', 'table_id'), 
('dependency_tables_on_indexes', '_columns', 'type_digits'), 
('dependency_tables_on_indexes', 'keys', 'id'), 
('dependency_tables_on_triggers', 'keys', 'action'), 
('dependency_tables_on_triggers', 'keys', 'name'), 
('dependency_tables_on_triggers', 'keys', 'rkey'), 
('dependency_tables_on_triggers', 'keys', 'ty
 pe')));
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to