Changeset: d8908cd33eae for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d8908cd33eae
Modified Files:
        sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out
        sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/emptydb-upgrade/Tests/upgrade.stable.out
        sql/test/emptydb/Tests/check.stable.out
        sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
        sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out
        sql/test/testdb-upgrade/Tests/upgrade.stable.out
Branch: Sep2022
Log Message:

Approve upgrade code for non-128 bit version.


diffs (truncated from 358 to 300 lines):

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
@@ -3778,6 +3778,25 @@ drop view sys.dump_start_sequences;
 drop view sys.dump_tables;
 drop view sys.describe_tables;
 drop view sys.dump_create_users;
+drop view sys.dump_functions;
+drop view sys.dump_triggers;
+drop function sys.schema_guard;
+drop function sys.replace_first(string, string, string, string);
+CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS 
STRING BEGIN
+RETURN
+ SELECT 'SET SCHEMA ' || sys.dq(sch) || '; ' || stmt;
+END;
+CREATE VIEW sys.dump_functions AS
+ SELECT f.o o, sys.schema_guard(f.sch, f.fun, f.def) stmt,
+ f.sch schema_name,
+ f.fun function_name
+ FROM sys.describe_functions f;
+CREATE VIEW sys.dump_triggers AS
+ SELECT sys.schema_guard(sch, tab, def) stmt,
+ sch schema_name,
+ tab table_name,
+ tri trigger_name
+ FROM sys.describe_triggers;
 CREATE VIEW sys.describe_partition_tables AS
  SELECT
  m_sch,
@@ -4017,9 +4036,10 @@ BEGIN
  INSERT INTO sys.dump_statements VALUES ((SELECT COUNT(*) FROM 
sys.dump_statements) + 1, 'COMMIT;');
  RETURN sys.dump_statements;
 END;
-update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users') 
AND schema_id = 2000;
+update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users', 
'dump_functions', 'dump_triggers') AND schema_id = 2000;
 update sys.functions set system = true where system <> true and name in 
('dump_table_data') and schema_id = 2000 and type = 2;
 update sys.functions set system = true where system <> true and name in 
('dump_database') and schema_id = 2000 and type = 5;
+update sys.functions set system = true where system <> true and name in 
('schema_guard') and schema_id = 2000 and type = 1;
 CREATE function sys.url_extract_host(url string, no_www bool) RETURNS STRING
 EXTERNAL NAME url."extractURLHost";
 GRANT EXECUTE ON FUNCTION url_extract_host(string, bool) TO PUBLIC;
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
@@ -3772,6 +3772,25 @@ drop view sys.dump_start_sequences;
 drop view sys.dump_tables;
 drop view sys.describe_tables;
 drop view sys.dump_create_users;
+drop view sys.dump_functions;
+drop view sys.dump_triggers;
+drop function sys.schema_guard;
+drop function sys.replace_first(string, string, string, string);
+CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS 
STRING BEGIN
+RETURN
+ SELECT 'SET SCHEMA ' || sys.dq(sch) || '; ' || stmt;
+END;
+CREATE VIEW sys.dump_functions AS
+ SELECT f.o o, sys.schema_guard(f.sch, f.fun, f.def) stmt,
+ f.sch schema_name,
+ f.fun function_name
+ FROM sys.describe_functions f;
+CREATE VIEW sys.dump_triggers AS
+ SELECT sys.schema_guard(sch, tab, def) stmt,
+ sch schema_name,
+ tab table_name,
+ tri trigger_name
+ FROM sys.describe_triggers;
 CREATE VIEW sys.describe_partition_tables AS
  SELECT
  m_sch,
@@ -4011,9 +4030,10 @@ BEGIN
  INSERT INTO sys.dump_statements VALUES ((SELECT COUNT(*) FROM 
sys.dump_statements) + 1, 'COMMIT;');
  RETURN sys.dump_statements;
 END;
-update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users') 
AND schema_id = 2000;
+update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users', 
'dump_functions', 'dump_triggers') AND schema_id = 2000;
 update sys.functions set system = true where system <> true and name in 
('dump_table_data') and schema_id = 2000 and type = 2;
 update sys.functions set system = true where system <> true and name in 
('dump_database') and schema_id = 2000 and type = 5;
+update sys.functions set system = true where system <> true and name in 
('schema_guard') and schema_id = 2000 and type = 1;
 CREATE function sys.url_extract_host(url string, no_www bool) RETURNS STRING
 EXTERNAL NAME url."extractURLHost";
 GRANT EXECUTE ON FUNCTION url_extract_host(string, bool) TO PUBLIC;
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
@@ -2646,6 +2646,25 @@ drop view sys.dump_start_sequences;
 drop view sys.dump_tables;
 drop view sys.describe_tables;
 drop view sys.dump_create_users;
+drop view sys.dump_functions;
+drop view sys.dump_triggers;
+drop function sys.schema_guard;
+drop function sys.replace_first(string, string, string, string);
+CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS 
STRING BEGIN
+RETURN
+ SELECT 'SET SCHEMA ' || sys.dq(sch) || '; ' || stmt;
+END;
+CREATE VIEW sys.dump_functions AS
+ SELECT f.o o, sys.schema_guard(f.sch, f.fun, f.def) stmt,
+ f.sch schema_name,
+ f.fun function_name
+ FROM sys.describe_functions f;
+CREATE VIEW sys.dump_triggers AS
+ SELECT sys.schema_guard(sch, tab, def) stmt,
+ sch schema_name,
+ tab table_name,
+ tri trigger_name
+ FROM sys.describe_triggers;
 CREATE VIEW sys.describe_partition_tables AS
  SELECT
  m_sch,
@@ -2885,9 +2904,10 @@ BEGIN
  INSERT INTO sys.dump_statements VALUES ((SELECT COUNT(*) FROM 
sys.dump_statements) + 1, 'COMMIT;');
  RETURN sys.dump_statements;
 END;
-update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users') 
AND schema_id = 2000;
+update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users', 
'dump_functions', 'dump_triggers') AND schema_id = 2000;
 update sys.functions set system = true where system <> true and name in 
('dump_table_data') and schema_id = 2000 and type = 2;
 update sys.functions set system = true where system <> true and name in 
('dump_database') and schema_id = 2000 and type = 5;
+update sys.functions set system = true where system <> true and name in 
('schema_guard') and schema_id = 2000 and type = 1;
 CREATE function sys.url_extract_host(url string, no_www bool) RETURNS STRING
 EXTERNAL NAME url."extractURLHost";
 GRANT EXECUTE ON FUNCTION url_extract_host(string, bool) TO PUBLIC;
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
@@ -2640,6 +2640,25 @@ drop view sys.dump_start_sequences;
 drop view sys.dump_tables;
 drop view sys.describe_tables;
 drop view sys.dump_create_users;
+drop view sys.dump_functions;
+drop view sys.dump_triggers;
+drop function sys.schema_guard;
+drop function sys.replace_first(string, string, string, string);
+CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS 
STRING BEGIN
+RETURN
+ SELECT 'SET SCHEMA ' || sys.dq(sch) || '; ' || stmt;
+END;
+CREATE VIEW sys.dump_functions AS
+ SELECT f.o o, sys.schema_guard(f.sch, f.fun, f.def) stmt,
+ f.sch schema_name,
+ f.fun function_name
+ FROM sys.describe_functions f;
+CREATE VIEW sys.dump_triggers AS
+ SELECT sys.schema_guard(sch, tab, def) stmt,
+ sch schema_name,
+ tab table_name,
+ tri trigger_name
+ FROM sys.describe_triggers;
 CREATE VIEW sys.describe_partition_tables AS
  SELECT
  m_sch,
@@ -2879,9 +2898,10 @@ BEGIN
  INSERT INTO sys.dump_statements VALUES ((SELECT COUNT(*) FROM 
sys.dump_statements) + 1, 'COMMIT;');
  RETURN sys.dump_statements;
 END;
-update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users') 
AND schema_id = 2000;
+update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users', 
'dump_functions', 'dump_triggers') AND schema_id = 2000;
 update sys.functions set system = true where system <> true and name in 
('dump_table_data') and schema_id = 2000 and type = 2;
 update sys.functions set system = true where system <> true and name in 
('dump_database') and schema_id = 2000 and type = 5;
+update sys.functions set system = true where system <> true and name in 
('schema_guard') and schema_id = 2000 and type = 1;
 CREATE function sys.url_extract_host(url string, no_www bool) RETURNS STRING
 EXTERNAL NAME url."extractURLHost";
 GRANT EXECUTE ON FUNCTION url_extract_host(string, bool) TO PUBLIC;
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
@@ -1932,7 +1932,6 @@ select 'null in value_partitions.value',
 [ "sys.functions",     "sys",  "replace",      "SYSTEM",       "replace",      
"str",  "Internal C",   "Scalar function",      false,  false,  false,  false,  
NULL,   "res_0",        "char", 0,      0,      "out",  "arg_1",        "char", 
0,      0,      "in",   "arg_2",        "char", 0,      0,      "in",   
"arg_3",        "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    ]
 [ "sys.functions",     "sys",  "replace",      "SYSTEM",       "replace",      
"str",  "Internal C",   "Scalar function",      false,  false,  false,  false,  
NULL,   "res_0",        "clob", 0,      0,      "out",  "arg_1",        "clob", 
0,      0,      "in",   "arg_2",        "clob", 0,      0,      "in",   
"arg_3",        "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    ]
 [ "sys.functions",     "sys",  "replace",      "SYSTEM",       "replace",      
"str",  "Internal C",   "Scalar function",      false,  false,  false,  false,  
NULL,   "res_0",        "varchar",      0,      0,      "out",  "arg_1",        
"varchar",      0,      0,      "in",   "arg_2",        "varchar",      0,      
0,      "in",   "arg_3",        "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    ]
-[ "sys.functions",     "sys",  "replace_first",        "SYSTEM",       "create 
function sys.replace_first(ori string, pat string, rep string, flg string) 
returns string external name \"pcre\".\"replace_first\";",   "pcre", "MAL",  
"Scalar function",      false,  false,  false,  true,   NULL,   "result",       
"clob", 0,      0,      "out",  "ori",  "clob", 0,      0,      "in",   "pat",  
"clob", 0,      0,      "in",   "rep",  "clob", 0,      0,      "in",   "flg",  
"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    ]
 [ "sys.functions",     "sys",  "restart",      "SYSTEM",       "restart",      
"sql",  "Internal C",   "Scalar function",      true,   false,  false,  true,   
NULL,   "res_0",        "bigint",       64,     0,      "out",  "arg_1",        
"char", 0,      0,      "in",   "arg_2",        "char", 0,      0,      "in",   
"arg_3",        "bigint",       64,     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    ]
 [ "sys.functions",     "sys",  "restart",      "SYSTEM",       "restart",      
"sql",  "Internal C",   "Scalar function",      true,   false,  false,  true,   
NULL,   "res_0",        "bigint",       64,     0,      "out",  "arg_1",        
"clob", 0,      0,      "in",   "arg_2",        "clob", 0,      0,      "in",   
"arg_3",        "bigint",       64,     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    ]
 [ "sys.functions",     "sys",  "restart",      "SYSTEM",       "restart",      
"sql",  "Internal C",   "Scalar function",      true,   false,  false,  true,   
NULL,   "res_0",        "bigint",       64,     0,      "out",  "arg_1",        
"varchar",      0,      0,      "in",   "arg_2",        "varchar",      0,      
0,      "in",   "arg_3",        "bigint",       64,     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    ]
@@ -1968,7 +1967,7 @@ select 'null in value_partitions.value',
 [ "sys.functions",     "sys",  "rtrim",        "SYSTEM",       "rtrim2",       
"str",  "Internal C",   "Scalar function",      false,  false,  false,  false,  
NULL,   "res_0",        "char", 0,      0,      "out",  "arg_1",        "char", 
0,      0,      "in",   "arg_2",        "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    ]
 [ "sys.functions",     "sys",  "rtrim",        "SYSTEM",       "rtrim2",       
"str",  "Internal C",   "Scalar function",      false,  false,  false,  false,  
NULL,   "res_0",        "clob", 0,      0,      "out",  "arg_1",        "clob", 
0,      0,      "in",   "arg_2",        "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    ]
 [ "sys.functions",     "sys",  "rtrim",        "SYSTEM",       "rtrim2",       
"str",  "Internal C",   "Scalar function",      false,  false,  false,  false,  
NULL,   "res_0",        "varchar",      0,      0,      "out",  "arg_1",        
"varchar",      0,      0,      "in",   "arg_2",        "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    ]
-[ "sys.functions",     "sys",  "schema_guard", "SYSTEM",       "create 
function sys.schema_guard(sch string, nme string, stmt string) returns string 
begin return select sys.replace_first(stmt, '(\\\\s*\"?' || sch || 
'\"?\\\\s*\\\\.|)\\\\s*\"?' || nme || '\"?\\\\s*', ' ' || sys.fqn(sch, nme) || 
' ', 'imsx'); end;",    "sql",  "SQL",  "Scalar function",      false,  false,  
false,  true,   NULL,   "result",       "clob", 0,      0,      "out",  "sch",  
"clob", 0,      0,      "in",   "nme",  "clob", 0,      0,      "in",   "stmt", 
"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    ]
+[ "sys.functions",     "sys",  "schema_guard", "SYSTEM",       "create 
function sys.schema_guard(sch string, nme string, stmt string) returns string 
begin return select 'SET SCHEMA ' || sys.dq(sch) || '; ' || stmt; end;",  
"sql",  "SQL",  "Scalar function",      false,  false,  false,  true,   NULL,   
"result",       "clob", 0,      0,      "out",  "sch",  "clob", 0,      0,      
"in",   "nme",  "clob", 0,      0,      "in",   "stmt", "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    ]
 [ "sys.functions",     "sys",  "second",       "SYSTEM",       "seconds",      
"mtime",        "Internal C",   "Scalar function",      false,  false,  false,  
false,  NULL,   "res_0",        "int",  32,     0,      "out",  "arg_1",        
"day_interval", 4,      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",  "second",       "SYSTEM",       "seconds",      
"mtime",        "Internal C",   "Scalar function",      false,  false,  false,  
false,  NULL,   "res_0",        "int",  32,     0,      "out",  "arg_1",        
"sec_interval", 13,     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",  "second",       "SYSTEM",       "sql_seconds",  
"mtime",        "Internal C",   "Scalar function",      false,  false,  false,  
false,  NULL,   "res_0",        "decimal",      9,      6,      "out",  
"arg_1",        "time", 7,      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    ]
@@ -2549,8 +2548,7 @@ select 'null in value_partitions.value',
 [ "function used by function", "sys",  "sq",   "sys",  
"get_remote_table_expressions", "FUNCTION"      ]
 [ "function used by function", "sys",  "ms_trunc",     "sys",  "ms_round",     
"FUNCTION"      ]
 [ "function used by function", "sys",  "dq",   "sys",  "prepare_esc",  
"FUNCTION"      ]
-[ "function used by function", "sys",  "fqn",  "sys",  "schema_guard", 
"FUNCTION"      ]
-[ "function used by function", "sys",  "replace_first",        "sys",  
"schema_guard", "FUNCTION"      ]
+[ "function used by function", "sys",  "dq",   "sys",  "schema_guard", 
"FUNCTION"      ]
 [ "function used by function", "sys",  "st_numgeometries",     "sys",  
"st_numpatches",        "FUNCTION"      ]
 [ "function used by function", "sys",  "st_geometryn", "sys",  "st_patchn",    
"FUNCTION"      ]
 [ "function used by function", "sys",  "getproj4",     "sys",  "st_transform", 
"FUNCTION"      ]
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
@@ -3778,6 +3778,25 @@ drop view sys.dump_start_sequences;
 drop view sys.dump_tables;
 drop view sys.describe_tables;
 drop view sys.dump_create_users;
+drop view sys.dump_functions;
+drop view sys.dump_triggers;
+drop function sys.schema_guard;
+drop function sys.replace_first(string, string, string, string);
+CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS 
STRING BEGIN
+RETURN
+ SELECT 'SET SCHEMA ' || sys.dq(sch) || '; ' || stmt;
+END;
+CREATE VIEW sys.dump_functions AS
+ SELECT f.o o, sys.schema_guard(f.sch, f.fun, f.def) stmt,
+ f.sch schema_name,
+ f.fun function_name
+ FROM sys.describe_functions f;
+CREATE VIEW sys.dump_triggers AS
+ SELECT sys.schema_guard(sch, tab, def) stmt,
+ sch schema_name,
+ tab table_name,
+ tri trigger_name
+ FROM sys.describe_triggers;
 CREATE VIEW sys.describe_partition_tables AS
  SELECT
  m_sch,
@@ -4017,9 +4036,10 @@ BEGIN
  INSERT INTO sys.dump_statements VALUES ((SELECT COUNT(*) FROM 
sys.dump_statements) + 1, 'COMMIT;');
  RETURN sys.dump_statements;
 END;
-update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users') 
AND schema_id = 2000;
+update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users', 
'dump_functions', 'dump_triggers') AND schema_id = 2000;
 update sys.functions set system = true where system <> true and name in 
('dump_table_data') and schema_id = 2000 and type = 2;
 update sys.functions set system = true where system <> true and name in 
('dump_database') and schema_id = 2000 and type = 5;
+update sys.functions set system = true where system <> true and name in 
('schema_guard') and schema_id = 2000 and type = 1;
 CREATE function sys.url_extract_host(url string, no_www bool) RETURNS STRING
 EXTERNAL NAME url."extractURLHost";
 GRANT EXECUTE ON FUNCTION url_extract_host(string, bool) TO PUBLIC;
diff --git a/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out 
b/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
--- a/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
+++ b/sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out
@@ -3772,6 +3772,25 @@ drop view sys.dump_start_sequences;
 drop view sys.dump_tables;
 drop view sys.describe_tables;
 drop view sys.dump_create_users;
+drop view sys.dump_functions;
+drop view sys.dump_triggers;
+drop function sys.schema_guard;
+drop function sys.replace_first(string, string, string, string);
+CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS 
STRING BEGIN
+RETURN
+ SELECT 'SET SCHEMA ' || sys.dq(sch) || '; ' || stmt;
+END;
+CREATE VIEW sys.dump_functions AS
+ SELECT f.o o, sys.schema_guard(f.sch, f.fun, f.def) stmt,
+ f.sch schema_name,
+ f.fun function_name
+ FROM sys.describe_functions f;
+CREATE VIEW sys.dump_triggers AS
+ SELECT sys.schema_guard(sch, tab, def) stmt,
+ sch schema_name,
+ tab table_name,
+ tri trigger_name
+ FROM sys.describe_triggers;
 CREATE VIEW sys.describe_partition_tables AS
  SELECT
  m_sch,
@@ -4011,9 +4030,10 @@ BEGIN
  INSERT INTO sys.dump_statements VALUES ((SELECT COUNT(*) FROM 
sys.dump_statements) + 1, 'COMMIT;');
  RETURN sys.dump_statements;
 END;
-update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users') 
AND schema_id = 2000;
+update sys._tables set system = true where name in 
('describe_partition_tables', 'dump_partition_tables', 'dump_sequences', 
'dump_start_sequences', 'describe_tables', 'dump_tables', 'dump_create_users', 
'dump_functions', 'dump_triggers') AND schema_id = 2000;
 update sys.functions set system = true where system <> true and name in 
('dump_table_data') and schema_id = 2000 and type = 2;
 update sys.functions set system = true where system <> true and name in 
('dump_database') and schema_id = 2000 and type = 5;
+update sys.functions set system = true where system <> true and name in 
('schema_guard') and schema_id = 2000 and type = 1;
 CREATE function sys.url_extract_host(url string, no_www bool) RETURNS STRING
 EXTERNAL NAME url."extractURLHost";
 GRANT EXECUTE ON FUNCTION url_extract_host(string, bool) TO PUBLIC;
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
@@ -2646,6 +2646,25 @@ drop view sys.dump_start_sequences;
 drop view sys.dump_tables;
 drop view sys.describe_tables;
 drop view sys.dump_create_users;
+drop view sys.dump_functions;
+drop view sys.dump_triggers;
+drop function sys.schema_guard;
+drop function sys.replace_first(string, string, string, string);
+CREATE FUNCTION sys.schema_guard(sch STRING, nme STRING, stmt STRING) RETURNS 
STRING BEGIN
+RETURN
+ SELECT 'SET SCHEMA ' || sys.dq(sch) || '; ' || stmt;
+END;
+CREATE VIEW sys.dump_functions AS
+ SELECT f.o o, sys.schema_guard(f.sch, f.fun, f.def) stmt,
+ f.sch schema_name,
+ f.fun function_name
+ FROM sys.describe_functions f;
+CREATE VIEW sys.dump_triggers AS
+ SELECT sys.schema_guard(sch, tab, def) stmt,
+ sch schema_name,
+ tab table_name,
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to