Changeset: c56fc93f2055 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c56fc93f2055 Added Files: sql/test/BugTracker-2018/Tests/sqlitelogictest-algebra-rangejoin-undefined.Bug-6610.sql Removed Files: sql/scripts/21_dependency_functions.sql Modified Files: clients/Tests/MAL-signatures.stable.out clients/Tests/MAL-signatures.stable.out.int128 monetdb5/modules/mal/wlc.mal sql/ChangeLog sql/backends/monet5/sql_upgrades.c sql/backends/monet5/wlr.mal sql/scripts/Makefile.ag sql/test/BugTracker-2016/Tests/catalog_name_qualifier.Bug-3948.sql sql/test/BugTracker-2016/Tests/catalog_name_qualifier.Bug-3948.stable.err sql/test/BugTracker-2016/Tests/catalog_name_qualifier.Bug-3948.stable.out sql/test/BugTracker-2016/Tests/fk-smaller-pk.Bug-3983.sql sql/test/BugTracker-2016/Tests/fk-smaller-pk.Bug-3983.stable.out sql/test/BugTracker-2018/Tests/All sql/test/Dependencies/Tests/Dependencies.stable.out sql/test/Dependencies/Tests/Dependencies.stable.out.int128 sql/test/Tests/systemfunctions.stable.out sql/test/Tests/systemfunctions.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.32bit sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64.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.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 sql/test/remote/Tests/partition_elim.stable.out 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.32bit 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.32bit sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: merge-partitions Log Message:
Merge with default diffs (truncated from 3469 to 300 lines): diff --git a/clients/Tests/MAL-signatures.stable.out b/clients/Tests/MAL-signatures.stable.out --- a/clients/Tests/MAL-signatures.stable.out +++ b/clients/Tests/MAL-signatures.stable.out @@ -11176,6 +11176,7 @@ stdout of test 'MAL-signatures` in direc [ "wlc", "append", "pattern wlc.append(sname:str, tname:str, cname:str, ins:any):int ", "WLCappend;", "Keep the insertions in the workload-capture-replay list" ] [ "wlc", "catalog", "pattern wlc.catalog(q:str):void ", "WLCcatalog;", "Keep the catalog changing queries for replay. " ] [ "wlc", "clear_table", "pattern wlc.clear_table(sname:str, tname:str):int ", "WLCclear_table;", "Keep the deletions in the workload-capture-replay list" ] +[ "wlc", "comment_on", "pattern wlc.comment_on(objid:int, remark:str):void ", "WLCgeneric;", "Catalog operation comment_on" ] [ "wlc", "commit", "pattern wlc.commit():void ", "WLCcommitCmd;", "Commit the workload-capture-replay record" ] [ "wlc", "commit", "pattern wlc.commit():void ", "WLCcommitCmd;", "Mark the end of the work unit" ] [ "wlc", "create_function", "pattern wlc.create_function(sname:str, fname:str):void ", "WLCgeneric;", "Catalog operation create_function" ] @@ -11238,6 +11239,7 @@ stdout of test 'MAL-signatures` in direc [ "wlr", "append", "pattern wlr.append(sname:str, tname:str, cname:str, ins:any...):int ", "WLRappend;", "Apply the insertions in the workload-capture-replay list" ] [ "wlr", "catalog", "pattern wlr.catalog(q:str):void ", "WLRcatalog;", "A catalog changing query" ] [ "wlr", "clear_table", "pattern wlr.clear_table(sname:str, tname:str):int ", "WLRclear_table;", "Destroy the tuples in the table" ] +[ "wlr", "comment_on", "pattern wlr.comment_on(objid:int, remark:str):void ", "WLRgeneric;", "Catalog operation comment_on" ] [ "wlr", "commit", "pattern wlr.commit():void ", "WLRcommit;", "Mark the end of the work unit" ] [ "wlr", "create_function", "pattern wlr.create_function(sname:str, fname:str):void ", "WLRgeneric;", "Catalog operation create_function" ] [ "wlr", "create_role", "pattern wlr.create_role(sname:str, role:str, grator:int):void ", "WLRgeneric;", "Catalog operation create_role" ] diff --git a/clients/Tests/MAL-signatures.stable.out.int128 b/clients/Tests/MAL-signatures.stable.out.int128 --- a/clients/Tests/MAL-signatures.stable.out.int128 +++ b/clients/Tests/MAL-signatures.stable.out.int128 @@ -15392,6 +15392,7 @@ Ready. [ "wlc", "append", "pattern wlc.append(sname:str, tname:str, cname:str, ins:any):int ", "WLCappend;", "Keep the insertions in the workload-capture-replay list" ] [ "wlc", "catalog", "pattern wlc.catalog(q:str):void ", "WLCcatalog;", "Keep the catalog changing queries for replay. " ] [ "wlc", "clear_table", "pattern wlc.clear_table(sname:str, tname:str):int ", "WLCclear_table;", "Keep the deletions in the workload-capture-replay list" ] +[ "wlc", "comment_on", "pattern wlc.comment_on(objid:int, remark:str):void ", "WLCgeneric;", "Catalog operation comment_on" ] [ "wlc", "commit", "pattern wlc.commit():void ", "WLCcommitCmd;", "Commit the workload-capture-replay record" ] [ "wlc", "commit", "pattern wlc.commit():void ", "WLCcommitCmd;", "Mark the end of the work unit" ] [ "wlc", "create_function", "pattern wlc.create_function(sname:str, fname:str):void ", "WLCgeneric;", "Catalog operation create_function" ] @@ -15454,6 +15455,7 @@ Ready. [ "wlr", "append", "pattern wlr.append(sname:str, tname:str, cname:str, ins:any...):int ", "WLRappend;", "Apply the insertions in the workload-capture-replay list" ] [ "wlr", "catalog", "pattern wlr.catalog(q:str):void ", "WLRcatalog;", "A catalog changing query" ] [ "wlr", "clear_table", "pattern wlr.clear_table(sname:str, tname:str):int ", "WLRclear_table;", "Destroy the tuples in the table" ] +[ "wlr", "comment_on", "pattern wlr.comment_on(objid:int, remark:str):void ", "WLRgeneric;", "Catalog operation comment_on" ] [ "wlr", "commit", "pattern wlr.commit():void ", "WLRcommit;", "Mark the end of the work unit" ] [ "wlr", "create_function", "pattern wlr.create_function(sname:str, fname:str):void ", "WLRgeneric;", "Catalog operation create_function" ] [ "wlr", "create_role", "pattern wlr.create_role(sname:str, role:str, grator:int):void ", "WLRgeneric;", "Catalog operation create_role" ] diff --git a/monetdb5/modules/mal/wlc.mal b/monetdb5/modules/mal/wlc.mal --- a/monetdb5/modules/mal/wlc.mal +++ b/monetdb5/modules/mal/wlc.mal @@ -226,6 +226,10 @@ pattern alter_add_range_partition( sname address WLCgeneric comment "Catalog operation alter_add_range_partition"; +pattern comment_on(objid:int, remark:str) +address WLCgeneric +comment "Catalog operation comment_on"; + pattern transaction_release(chain:int,name:str):void address WLCgeneric comment "A transaction statement (type can be commit,release,rollback or start)"; diff --git a/sql/ChangeLog b/sql/ChangeLog --- a/sql/ChangeLog +++ b/sql/ChangeLog @@ -1,6 +1,52 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Thu Jun 7 2018 Martin van Dinther <martin.van.dint...@monetdbsolutions.com> +- Removed deprecated table producing system functions: + sys.dependencies_columns_on_functions() + sys.dependencies_columns_on_indexes() + sys.dependencies_columns_on_keys() + sys.dependencies_columns_on_triggers() + sys.dependencies_columns_on_views() + sys.dependencies_functions_on_functions() + sys.dependencies_functions_on_triggers() + sys.dependencies_keys_on_foreignkeys() + sys.dependencies_owners_on_schemas() + sys.dependencies_schemas_on_users() + sys.dependencies_tables_on_foreignkeys() + sys.dependencies_tables_on_functions() + sys.dependencies_tables_on_indexes() + sys.dependencies_tables_on_triggers() + sys.dependencies_tables_on_views() + sys.dependencies_views_on_functions() + sys.dependencies_views_on_triggers() + They are replaced by new system dependency_* views: + sys.dependency_args_on_types + sys.dependency_columns_on_functions + sys.dependency_columns_on_indexes + sys.dependency_columns_on_keys + sys.dependency_columns_on_procedures + sys.dependency_columns_on_triggers + sys.dependency_columns_on_types + sys.dependency_columns_on_views + sys.dependency_functions_on_functions + sys.dependency_functions_on_procedures + sys.dependency_functions_on_triggers + sys.dependency_functions_on_types + sys.dependency_functions_on_views + sys.dependency_keys_on_foreignkeys + sys.dependency_owners_on_schemas + sys.dependency_schemas_on_users + sys.dependency_tables_on_foreignkeys + sys.dependency_tables_on_functions + sys.dependency_tables_on_indexes + sys.dependency_tables_on_procedures + sys.dependency_tables_on_triggers + sys.dependency_tables_on_views + sys.dependency_views_on_functions + sys.dependency_views_on_procedures + sys.dependency_views_on_views + * Tue Mar 13 2018 Pedro Ferreira <pedro.ferre...@monetdbsolutions.com> - Implemented group_concat(X,Y) aggregate function which also concatenates a column of strings X, but using a supplied string Y as 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 @@ -1784,6 +1784,48 @@ sql_update_default(Client c, mvc *sql) return err; /* usually MAL_SUCCEED */ } +static str +sql_drop_functions_dependencies_Xs_on_Ys(Client c, mvc *sql) +{ + size_t bufsize = 1600, pos = 0; + char *schema = NULL, *err = NULL; + char *buf = GDKmalloc(bufsize); + + if (buf == NULL) + throw(SQL, "sql_drop_functions_dependencies_Xs_on_Ys", SQLSTATE(HY001) MAL_MALLOC_FAIL); + schema = stack_get_string(sql, "current_schema"); + /* remove functions which were created in sql/scripts/21_dependency_functions.sql */ + pos += snprintf(buf + pos, bufsize - pos, + "set schema \"sys\";\n" + "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" + "delete from systemfunctions where function_id not in (select id from functions);\n"); + if (schema) + pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", schema); + pos += snprintf(buf + pos, bufsize - pos, "commit;\n"); + assert(pos < bufsize); + + printf("Running database upgrade commands:\n%s\n", buf); + err = SQLstatementIntern(c, &buf, "update", 1, 0, NULL); + GDKfree(buf); + return err; /* usually MAL_SUCCEED */ +} + void SQLupgrades(Client c, mvc *m) { @@ -1926,7 +1968,7 @@ SQLupgrades(Client c, mvc *m) BAT *b = BATdescriptor(output->cols[0].b); if (b) { if (BATcount(b) > 0) { - /* yes old view definiton exists, it needs to be replaced */ + /* yes old view definition exists, it needs to be replaced */ if ((err = sql_replace_Mar2018_ids_view(c, m)) != NULL) { fprintf(stderr, "!%s\n", err); freeException(err); @@ -1962,6 +2004,29 @@ SQLupgrades(Client c, mvc *m) } } + if (sql_bind_func(m->sa, s, "dependencies_schemas_on_users", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_owners_on_schemas", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_tables_on_views", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_tables_on_indexes", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_tables_on_triggers", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_tables_on_foreignkeys", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_tables_on_functions", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_columns_on_views", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_columns_on_keys", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_columns_on_indexes", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_columns_on_functions", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_columns_on_triggers", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_views_on_functions", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_views_on_triggers", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_functions_on_functions", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_functions_on_triggers", NULL, NULL, F_UNION) + && sql_bind_func(m->sa, s, "dependencies_keys_on_foreignkeys", NULL, NULL, F_UNION) ) { + if ((err = sql_drop_functions_dependencies_Xs_on_Ys(c, m)) != NULL) { + fprintf(stderr, "!%s\n", err); + freeException(err); + } + } + if (mvc_bind_table(m, s, "_table_partitions") == NULL) { if ((err = sql_update_merge_partitions(c, m)) != NULL) { fprintf(stderr, "!%s\n", err); diff --git a/sql/backends/monet5/wlr.mal b/sql/backends/monet5/wlr.mal --- a/sql/backends/monet5/wlr.mal +++ b/sql/backends/monet5/wlr.mal @@ -231,6 +231,10 @@ pattern alter_add_range_partition( sname address WLRgeneric comment "Catalog operation alter_add_range_partition"; +pattern comment_on(objid:int, remark:str) +address WLRgeneric +comment "Catalog operation comment_on"; + pattern transaction_release(chain:int,name:str):void address WLRgeneric comment "A transaction statement (type can be commit,release,rollback or start)"; diff --git a/sql/scripts/21_dependency_functions.sql b/sql/scripts/21_dependency_functions.sql deleted file mode 100644 --- a/sql/scripts/21_dependency_functions.sql +++ /dev/null @@ -1,100 +0,0 @@ --- This Source Code Form is subject to the terms of the Mozilla Public --- License, v. 2.0. If a copy of the MPL was not distributed with this --- file, You can obtain one at http://mozilla.org/MPL/2.0/. --- --- Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V. - --- Note: these table producing functions are deprecated as of Febr 2018 --- and have been replaced by views, see 21_dependency_views.sql. - ---Schema s has a dependency on user u -CREATE FUNCTION dependencies_schemas_on_users() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT s.name, u.name, 'DEP_USER' from schemas as s, users u where u.default_schema = s.id); - ---User (owner) has a dependency in schema s -CREATE FUNCTION dependencies_owners_on_schemas() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT a.name, s.name, 'DEP_SCHEMA' from schemas as s, auths a where s.owner = a.id); - - ---Table t has a dependency on view v -CREATE FUNCTION dependencies_tables_on_views() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT t.name, v.name, 'DEP_VIEW' from tables as t, tables as v, dependencies as dep where t.id = dep.id AND v.id = dep.depend_id AND dep.depend_type = 5 AND v.type = 1); - ---Table t has a dependency on index i -CREATE FUNCTION dependencies_tables_on_indexes() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT t.name, i.name, 'DEP_INDEX' from tables as t, idxs as i where i.table_id = t.id and i.name not in (select name from keys) and t.type = 0); - ---Table t has a dependency on trigger tri - -CREATE FUNCTION dependencies_tables_on_triggers() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE ((SELECT t.name, tri.name, 'DEP_TRIGGER' from tables as t, triggers as tri where tri.table_id = t.id) UNION (SELECT t.name, tri.name, 'DEP_TRIGGER' from triggers tri, tables t, dependencies dep where dep.id = t.id AND dep.depend_id =tri.id AND dep.depend_type = 8)); - ---Table t has a dependency on foreign key k -CREATE FUNCTION dependencies_tables_on_foreignKeys() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT t.name, fk.name, 'DEP_FKEY' from tables as t, keys as k, keys as fk where fk.rkey = k.id and k.table_id = t.id); - ---Table t has a dependency on function f -CREATE FUNCTION dependencies_tables_on_functions() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT t.name, f.name, 'DEP_FUNC' from functions as f, tables as t, dependencies as dep where t.id = dep.id AND f.id = dep.depend_id AND dep.depend_type = 7 AND t.type = 0); - - ---Column c has a dependency on view v -CREATE FUNCTION dependencies_columns_on_views() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT c.name, v.name, 'DEP_VIEW' from columns as c, tables as v, dependencies as dep where c.id = dep.id AND v.id = dep.depend_id AND dep.depend_type = 5 AND v.type = 1); - ---Column c has a dependency on key k -CREATE FUNCTION dependencies_columns_on_keys() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT c.name, k.name, 'DEP_KEY' from columns as c, objects as kc, keys as k where kc."name" = c.name AND kc.id = k.id AND k.table_id = c.table_id AND k.rkey = -1); - ---Column c has a dependency on index i -CREATE FUNCTION dependencies_columns_on_indexes() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT c.name, i.name, 'DEP_INDEX' from columns as c, objects as kc, idxs as i where kc."name" = c.name AND kc.id = i.id AND c.table_id = i.table_id AND i.name not in (select name from keys)); - ---Column c has a dependency on function f -CREATE FUNCTION dependencies_columns_on_functions() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT c.name, f.name, 'DEP_FUNC' from functions as f, columns as c, dependencies as dep where c.id = dep.id AND f.id = dep.depend_id AND dep.depend_type = 7); - ---Column c has a dependency on trigger tri -CREATE FUNCTION dependencies_columns_on_triggers() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT c.name, tri.name, 'DEP_TRIGGER' from columns as c, triggers as tri, dependencies as dep where dep.id = c.id AND dep.depend_id =tri.id AND dep.depend_type = 8); - - ---View v has a dependency on function f -CREATE FUNCTION dependencies_views_on_functions() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT v.name, f.name, 'DEP_FUNC' from functions as f, tables as v, dependencies as dep where v.id = dep.id AND f.id = dep.depend_id AND dep.depend_type = 7 AND v.type = 1); - ---View v has a dependency on trigger tri -CREATE FUNCTION dependencies_views_on_triggers() -RETURNS TABLE (sch varchar(100), usr varchar(100), dep_type varchar(32)) -RETURN TABLE (SELECT v.name, tri.name, 'DEP_TRIGGER' from tables as v, triggers as tri, dependencies as dep where dep.id = v.id AND dep.depend_id =tri.id AND dep.depend_type = 8 AND v.type = 1); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list