Changeset: 2c5349eb48e5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2c5349eb48e5
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        monetdb5/optimizer/optimizer.mal
        sql/backends/monet5/sql_upgrades.c
        sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: default
Log Message:

Deal with changes to sys.optimizer_stats() and fix inspect.optimizer_stats.


diffs (truncated from 342 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
@@ -7746,7 +7746,7 @@ Ready.
 [ "inspect",   "getSize",      "pattern inspect.getSize():lng ",       
"INSPECTgetSize;",      "Return the storage size for the current function (in 
bytes)."  ]
 [ "inspect",   "getSource",    "pattern inspect.getSource(mod:str, 
fcn:str):str ",     "INSPECTgetSource;",    "Return the original input for a 
function."     ]
 [ "inspect",   "getType",      "pattern inspect.getType(v:any_1):str ",        
"INSPECTtypeName;",     "Return the concrete type of a variable (expression)."  
]
-[ "inspect",   "optimizer_stats",      "command inspect.optimizer_stats() 
(X_0:bat[:str], X_1:bat[:int], X_2:bat[:lng]) ",     "QOTstatistics;",       
"Get optimizer use statistics, i.e. calls and total time"       ]
+[ "inspect",   "optimizer_stats",      "pattern inspect.optimizer_stats() 
(X_0:bat[:str], X_1:bat[:int], X_2:bat[:lng]) ",     "OPTstatistics;",       
"Get optimizer use statistics, i.e. calls and total time"       ]
 [ "io",        "export",       "command io.export(b:bat[:any_2], 
filepath:str):void ", "IOexport;",    "Export a BAT as ASCII to a file. If the 
'filepath' is not absolute, it\n is put into the $DBPATH directory. Success of 
failure is indicated."  ]
 [ "io",        "import",       "command io.import(b:bat[:any_2], 
filepath:str):void ", "IOimport;",    "Import a BAT from an ASCII dump. The 
tuples are appended to the\n first argument. Its signature must match the 
dump,\n else parsing errors will occur as an exception."        ]
 [ "io",        "print",        "pattern io.print(val:any_1):void ",    
"IOprint_val;", "Print a MAL value."    ]
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
@@ -10102,7 +10102,7 @@ Ready.
 [ "inspect",   "getSize",      "pattern inspect.getSize():lng ",       
"INSPECTgetSize;",      "Return the storage size for the current function (in 
bytes)."  ]
 [ "inspect",   "getSource",    "pattern inspect.getSource(mod:str, 
fcn:str):str ",     "INSPECTgetSource;",    "Return the original input for a 
function."     ]
 [ "inspect",   "getType",      "pattern inspect.getType(v:any_1):str ",        
"INSPECTtypeName;",     "Return the concrete type of a variable (expression)."  
]
-[ "inspect",   "optimizer_stats",      "command inspect.optimizer_stats() 
(X_0:bat[:str], X_1:bat[:int], X_2:bat[:lng]) ",     "QOTstatistics;",       
"Get optimizer use statistics, i.e. calls and total time"       ]
+[ "inspect",   "optimizer_stats",      "pattern inspect.optimizer_stats() 
(X_0:bat[:str], X_1:bat[:int], X_2:bat[:lng]) ",     "OPTstatistics;",       
"Get optimizer use statistics, i.e. calls and total time"       ]
 [ "io",        "export",       "command io.export(b:bat[:any_2], 
filepath:str):void ", "IOexport;",    "Export a BAT as ASCII to a file. If the 
'filepath' is not absolute, it\n is put into the $DBPATH directory. Success of 
failure is indicated."  ]
 [ "io",        "import",       "command io.import(b:bat[:any_2], 
filepath:str):void ", "IOimport;",    "Import a BAT from an ASCII dump. The 
tuples are appended to the\n first argument. Its signature must match the 
dump,\n else parsing errors will occur as an exception."        ]
 [ "io",        "print",        "pattern io.print(val:any_1):void ",    
"IOprint_val;", "Print a MAL value."    ]
diff --git a/monetdb5/optimizer/optimizer.mal b/monetdb5/optimizer/optimizer.mal
--- a/monetdb5/optimizer/optimizer.mal
+++ b/monetdb5/optimizer/optimizer.mal
@@ -245,7 +245,7 @@ comment "Reorder by dataflow dependencie
 
 #opt_statistics.mal
 
-command inspect.optimizer_stats()(:bat[:str], :bat[:int], :bat[:lng])
+pattern inspect.optimizer_stats()(:bat[:str], :bat[:int], :bat[:lng])
 address OPTstatistics
 comment "Get optimizer use statistics, i.e. calls and total time";
 
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
@@ -1295,7 +1295,11 @@ sql_update_default(Client c, mvc *sql)
        pos += snprintf(buf + pos, bufsize - pos,
                        "drop function sys.malfunctions;\n"
                        "create function sys.malfunctions() returns 
table(\"module\" string, \"function\" string, \"signature\" string, \"address\" 
string, \"comment\" string) external name \"manual\".\"functions\";\n"
-                       "insert into sys.systemfunctions (select id from 
sys.functions where name = 'malfunctions' and schema_id = (select id from 
sys.schemas where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));\n");
+                       "drop function sys.optimizer_stats();\n"
+                       "create function sys.optimizer_stats() "
+                       "returns table (optname string, count int, timing 
bigint) "
+                       "external name inspect.optimizer_stats;\n"
+                       "insert into sys.systemfunctions (select id from 
sys.functions where name in ('malfunctions', 'optimizer_stats') and schema_id = 
(select id from sys.schemas where name = 'sys') and id not in (select 
function_id from sys.systemfunctions));\n");
 
        /* 46_profiler.sql */
        pos += snprintf(buf + pos, bufsize - pos,
@@ -1336,14 +1340,7 @@ sql_update_default(Client c, mvc *sql)
                        "(3, 'SELECT,UPDATE'), (5, 'SELECT,INSERT'), (6, 
'INSERT,UPDATE'), (7, 'SELECT,INSERT,UPDATE'),\n"
                        "(9, 'SELECT,DELETE'), (10, 'UPDATE,DELETE'), (11, 
'SELECT,UPDATE,DELETE'), (12, 'INSERT,DELETE'),\n"
                        "(13, 'SELECT,INSERT,DELETE'), (14, 
'INSERT,UPDATE,DELETE'), (15, 'SELECT,INSERT,UPDATE,DELETE');\n"
-                       "update sys._tables set system = true where name in 
('function_languages', 'function_types', 'index_types', 'key_types', 
'privilege_codes') and schema_id = (select id from sys.schemas where name = 
'sys');\n"
-
-       /* optimizer  funtion */
-                       "drop function sys.optimizer_stats();\n"
-                       "create function sys.optimizer_stats ()\n"
-                       "returns table (optname string, count int, timing 
bigint)\n"
-                       "external name inspect.optimizer_stats;\n"
-       );
+                       "update sys._tables set system = true where name in 
('function_languages', 'function_types', 'index_types', 'key_types', 
'privilege_codes') and schema_id = (select id from sys.schemas where name = 
'sys');\n");
 
        /* 75_shp.sql, if shp extension available */
        err = SQLstatementIntern(c, &q1, "update", 1, 0, &output);
@@ -1363,6 +1360,9 @@ sql_update_default(Client c, mvc *sql)
        }
        res_tables_destroy(output);
 
+       pos += snprintf(buf + pos, bufsize - pos,
+                       "delete from sys.systemfunctions where function_id not 
in (select id from sys.functions);\n");
+
        if (schema)
                pos += snprintf(buf + pos, bufsize - pos, "set schema 
\"%s\";\n", 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
@@ -30,7 +30,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -66,6 +68,7 @@ INSERT INTO sys.privilege_codes (privile
 (9, 'SELECT,DELETE'), (10, 'UPDATE,DELETE'), (11, 'SELECT,UPDATE,DELETE'), 
(12, 'INSERT,DELETE'),
 (13, 'SELECT,INSERT,DELETE'), (14, 'INSERT,UPDATE,DELETE'), (15, 
'SELECT,INSERT,UPDATE,DELETE');
 update sys._tables set system = true where name in ('function_languages', 
'function_types', 'index_types', 'key_types', 'privilege_codes') and schema_id 
= (select id from sys.schemas where name = 'sys');
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "sys";
 
 # 15:26:18 >  
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
@@ -30,7 +30,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -66,6 +68,7 @@ INSERT INTO sys.privilege_codes (privile
 (9, 'SELECT,DELETE'), (10, 'UPDATE,DELETE'), (11, 'SELECT,UPDATE,DELETE'), 
(12, 'INSERT,DELETE'),
 (13, 'SELECT,INSERT,DELETE'), (14, 'INSERT,UPDATE,DELETE'), (15, 
'SELECT,INSERT,UPDATE,DELETE');
 update sys._tables set system = true where name in ('function_languages', 
'function_types', 'index_types', 'key_types', 'privilege_codes') and schema_id 
= (select id from sys.schemas where name = 'sys');
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "sys";
 
 # 15:41:19 >  
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
@@ -74,7 +74,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -110,6 +112,7 @@ INSERT INTO sys.privilege_codes (privile
 (9, 'SELECT,DELETE'), (10, 'UPDATE,DELETE'), (11, 'SELECT,UPDATE,DELETE'), 
(12, 'INSERT,DELETE'),
 (13, 'SELECT,INSERT,DELETE'), (14, 'INSERT,UPDATE,DELETE'), (15, 
'SELECT,INSERT,UPDATE,DELETE');
 update sys._tables set system = true where name in ('function_languages', 
'function_types', 'index_types', 'key_types', 'privilege_codes') and schema_id 
= (select id from sys.schemas where name = 'sys');
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "sys";
 
 
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
@@ -30,7 +30,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -69,6 +71,7 @@ update sys._tables set system = true whe
 drop procedure SHPload(integer);
 create procedure SHPload(fid integer) external name shp.import;
 insert into sys.systemfunctions (select id from sys.functions where name = 
'shpload' and schema_id = (select id from sys.schemas where name = 'sys') and 
id not in (select function_id from sys.systemfunctions));
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "sys";
 
 # 15:26:18 >  
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
@@ -30,7 +30,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -69,6 +71,7 @@ update sys._tables set system = true whe
 drop procedure SHPload(integer);
 create procedure SHPload(fid integer) external name shp.import;
 insert into sys.systemfunctions (select id from sys.functions where name = 
'shpload' and schema_id = (select id from sys.schemas where name = 'sys') and 
id not in (select function_id from sys.systemfunctions));
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "sys";
 
 # 15:41:18 >  
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
@@ -74,7 +74,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -113,6 +115,7 @@ update sys._tables set system = true whe
 drop procedure SHPload(integer);
 create procedure SHPload(fid integer) external name shp.import;
 insert into sys.systemfunctions (select id from sys.functions where name = 
'shpload' and schema_id = (select id from sys.schemas where name = 'sys') and 
id not in (select function_id from sys.systemfunctions));
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "sys";
 
 
diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128
@@ -28,7 +28,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -64,6 +66,7 @@ INSERT INTO sys.privilege_codes (privile
 (9, 'SELECT,DELETE'), (10, 'UPDATE,DELETE'), (11, 'SELECT,UPDATE,DELETE'), 
(12, 'INSERT,DELETE'),
 (13, 'SELECT,INSERT,DELETE'), (14, 'INSERT,UPDATE,DELETE'), (15, 
'SELECT,INSERT,UPDATE,DELETE');
 update sys._tables set system = true where name in ('function_languages', 
'function_types', 'index_types', 'key_types', 'privilege_codes') and schema_id 
= (select id from sys.schemas where name = 'sys');
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "testschema";
 
 # 15:26:22 >  
diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out 
b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
--- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
+++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
@@ -25,7 +25,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -61,6 +63,7 @@ INSERT INTO sys.privilege_codes (privile
 (9, 'SELECT,DELETE'), (10, 'UPDATE,DELETE'), (11, 'SELECT,UPDATE,DELETE'), 
(12, 'INSERT,DELETE'),
 (13, 'SELECT,INSERT,DELETE'), (14, 'INSERT,UPDATE,DELETE'), (15, 
'SELECT,INSERT,UPDATE,DELETE');
 update sys._tables set system = true where name in ('function_languages', 
'function_types', 'index_types', 'key_types', 'privilege_codes') and schema_id 
= (select id from sys.schemas where name = 'sys');
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "testschema";
 
 # 16:00:57 >  
diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128
@@ -69,7 +69,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -105,6 +107,7 @@ INSERT INTO sys.privilege_codes (privile
 (9, 'SELECT,DELETE'), (10, 'UPDATE,DELETE'), (11, 'SELECT,UPDATE,DELETE'), 
(12, 'INSERT,DELETE'),
 (13, 'SELECT,INSERT,DELETE'), (14, 'INSERT,UPDATE,DELETE'), (15, 
'SELECT,INSERT,UPDATE,DELETE');
 update sys._tables set system = true where name in ('function_languages', 
'function_types', 'index_types', 'key_types', 'privilege_codes') and schema_id 
= (select id from sys.schemas where name = 'sys');
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "testschema";
 
 
diff --git a/sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 
b/sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
--- a/sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
+++ b/sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128
@@ -30,7 +30,9 @@ delete from sys._columns where table_id 
 delete from sys._tables where name = 'connections' and schema_id = (select id 
from sys.schemas where name = 'sys');
 drop function sys.malfunctions;
 create function sys.malfunctions() returns table("module" string, "function" 
string, "signature" string, "address" string, "comment" string) external name 
"manual"."functions";
-insert into sys.systemfunctions (select id from sys.functions where name = 
'malfunctions' and schema_id = (select id from sys.schemas where name = 'sys') 
and id not in (select function_id from sys.systemfunctions));
+drop function sys.optimizer_stats();
+create function sys.optimizer_stats() returns table (optname string, count 
int, timing bigint) external name inspect.optimizer_stats;
+insert into sys.systemfunctions (select id from sys.functions where name in 
('malfunctions', 'optimizer_stats') and schema_id = (select id from sys.schemas 
where name = 'sys') and id not in (select function_id from 
sys.systemfunctions));
 create function profiler.getlimit() returns integer external name 
profiler.getlimit;
 create procedure profiler.setlimit(lim integer) external name 
profiler.setlimit;
 drop procedure profiler.setpoolsize;
@@ -69,6 +71,7 @@ update sys._tables set system = true whe
 drop procedure SHPload(integer);
 create procedure SHPload(fid integer) external name shp.import;
 insert into sys.systemfunctions (select id from sys.functions where name = 
'shpload' and schema_id = (select id from sys.schemas where name = 'sys') and 
id not in (select function_id from sys.systemfunctions));
+delete from sys.systemfunctions where function_id not in (select id from 
sys.functions);
 set schema "testschema";
 
 # 15:26:24 >  
diff --git a/sql/test/testdb-upgrade/Tests/upgrade.stable.out 
b/sql/test/testdb-upgrade/Tests/upgrade.stable.out
--- a/sql/test/testdb-upgrade/Tests/upgrade.stable.out
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to