Changeset: 9941d4d9b94d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9941d4d9b94d Modified Files: sql/backends/monet5/sql_upgrades.c sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.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.ppc64 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.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/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: default Log Message:
Fix and approve upgrade. diffs (truncated from 536 to 300 lines): diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -2392,7 +2392,8 @@ sql_update_default(Client c, mvc *sql, c " maxticks bigint,\n" " maxquery string\n" ")\n" - "external name sysmon.user_statistics;\n"); + "external name sysmon.user_statistics;\n" + "update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = %d;\n", (int) F_UNION); pos += snprintf(buf + pos, bufsize - pos, "set schema \"%s\";\n", prev_schema); 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 @@ -4104,6 +4104,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 --- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 +++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.ppc64.int128 @@ -4104,6 +4104,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded 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 @@ -3503,6 +3503,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit @@ -3503,6 +3503,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded 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 @@ -4178,6 +4178,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64 b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64 --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64 +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64 @@ -3503,6 +3503,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.ppc64.int128 @@ -4178,6 +4178,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded 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 @@ -4109,6 +4109,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded 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 @@ -3508,6 +3508,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit --- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit +++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit @@ -3508,6 +3508,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded 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 @@ -4183,6 +4183,18 @@ SELECT 'pi', pi() UNION ALL SELECT 'rowcnt', rowcnt; UPDATE sys._tables SET system = true WHERE name = 'var_values' AND schema_id = (SELECT id FROM sys.schemas WHERE name = 'sys'); GRANT SELECT ON sys.var_values TO PUBLIC; +create function sys.user_statistics() +returns table( + username string, + querycount bigint, + totalticks bigint, + started timestamp, + finished timestamp, + maxticks bigint, + maxquery string +) +external name sysmon.user_statistics; +update sys.functions set system = true where system <> true and name = 'user_statistics' and schema_id = (select id from sys.schemas where name = 'sys') and type = 5; set schema "sys"; # MonetDB/SQL module loaded diff --git a/sql/test/emptydb/Tests/check.stable.out b/sql/test/emptydb/Tests/check.stable.out --- a/sql/test/emptydb/Tests/check.stable.out +++ b/sql/test/emptydb/Tests/check.stable.out @@ -353,6 +353,7 @@ stdout of test 'check` in directory 'sql \dSf sys."time_to_str" \dSf sys."timestamp_to_str" \dSf sys."tracelog" +\dSf sys."user_statistics" \dSf sys."uuid" \dSf sys."vacuum" \dSf sys."var" @@ -863,6 +864,7 @@ SYSTEM FUNCTION sys.trim SYSTEM FUNCTION sys.truncate SYSTEM FUNCTION sys.ucase SYSTEM FUNCTION sys.upper +SYSTEM FUNCTION sys.user_statistics SYSTEM FUNCTION sys.uuid SYSTEM PROCEDURE sys.vacuum SYSTEM FUNCTION sys.var @@ -1370,6 +1372,7 @@ create function "text" (p inet) returns create function time_to_str(d time with time zone, format string) returns string external name mtime."time_to_str"; create function timestamp_to_str(d timestamp with time zone, format string) returns string external name mtime."timestamp_to_str"; create function sys.tracelog() returns table (ticks bigint, stmt string) external name sql.dump_trace; +create function sys.user_statistics() returns table(username string, querycount bigint, totalticks bigint, started timestamp, finished timestamp, maxticks bigint, maxquery string) external name sysmon.user_statistics; create function sys.uuid() returns uuid external name uuid."new"; create procedure vacuum(sys string, tab string) external name sql.vacuum; create function "sys"."var"() returns table("schema" string, "name" string, "type" string, "value" string) external name "sql"."sql_variables"; @@ -3484,6 +3487,7 @@ drop function pcre_replace(string, strin [ "sys.functions", "sys", "upper", "SYSTEM", "toUpper", "str", "Internal C", "Scalar function", false, false, false, false, "res_0", "char", 0, 0, "out", "arg_1", "char", 0, 0, "in", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ] [ "sys.functions", "sys", "upper", "SYSTEM", "toUpper", "str", "Internal C", "Scalar function", false, false, false, false, "res_0", "clob", 0, 0, "out", "arg_1", "clob", 0, 0, "in", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ] [ "sys.functions", "sys", "upper", "SYSTEM", "toUpper", "str", "Internal C", "Scalar function", false, false, false, false, "res_0", "varchar", 0, 0, "out", "arg_1", "varchar", 0, 0, "in", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ] +[ "sys.functions", "sys", "user_statistics", "SYSTEM", "create function sys.user_statistics() returns table(username string, querycount bigint, totalticks bigint, started timestamp, finished timestamp, maxticks bigint, maxquery string) external name sysmon.user_statistics;", "sysmon", "MAL", "Function returning a table", true, false, false, true, "username", "clob", 0, 0, "out", "querycount", "bigint", 64, 0, "out", "totalticks", "bigint", 64, 0, "out", "started", "timestamp", 7, 0, "out", "finished", "timestamp", 7, 0, "out", "maxticks", "bigint", 64, 0, "out", "maxquery", "clob", 0, 0, "out", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ] [ "sys.functions", "sys", "uuid", "SYSTEM", "create function sys.uuid() returns uuid external name uuid.\"new\";", "uuid", "MAL", "Scalar function", true, false, false, true, "result", "uuid", 0, 0, "out", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ] [ "sys.functions", "sys", "vacuum", "SYSTEM", "create procedure vacuum(sys string, tab string) external name sql.vacuum;", "sql", "MAL", "Procedure", true, false, false, true, "sys", "clob", 0, 0, "in", "tab", "clob", 0, 0, "in", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ] [ "sys.functions", "sys", "var", "SYSTEM", "create function \"sys\".\"var\"() returns table(\"schema\" string, \"name\" string, \"type\" string, \"value\" string) external name \"sql\".\"sql_variables\";", "sql", "SQL", "Function returning a table", false, false, false, true, "schema", "char", 0, 0, "out", "name", "char", 0, 0, "out", "type", "char", 0, 0, "out", "value", "char", 0, 0, "out", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ] diff --git a/sql/test/emptydb/Tests/check.stable.out.32bit b/sql/test/emptydb/Tests/check.stable.out.32bit --- a/sql/test/emptydb/Tests/check.stable.out.32bit +++ b/sql/test/emptydb/Tests/check.stable.out.32bit @@ -353,6 +353,7 @@ stdout of test 'check` in directory 'sql \dSf sys."time_to_str" \dSf sys."timestamp_to_str" \dSf sys."tracelog" +\dSf sys."user_statistics" \dSf sys."uuid" \dSf sys."vacuum" _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list