Changeset: 3e33256c30d8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/3e33256c30d8
Modified Files:
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
Branch: default
Log Message:

Approve changes.


diffs (48 lines):

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
@@ -1567,9 +1567,9 @@ select 'null in value_partitions.value',
 [ "sys.functions",     "sys",  "difference",   "SYSTEM",       "stringdiff",   
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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",  "dq",   "SYSTEM",       "create function sys.dq 
(s string) returns string begin return '\"' || sys.replace(s,'\"','\"\"') || 
'\"'; end;",       "sql",  "SQL",  "Scalar function",      false,  false,  
false,  true,   NULL,   "result",       "clob", 0,      0,      "out",  "s",    
"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",  "droporderindex",       "SYSTEM",       "create 
procedure sys.droporderindex(sys string, tab string, col string) external name 
sql.droporderindex;",    "sql",  "MAL",  "Procedure",    true,   false,  false, 
 true,   NULL,   "sys",  "clob", 0,      0,      "in",   "tab",  "clob", 0,     
 0,      "in",   "col",  "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",  "dump_database",        "SYSTEM",       "create 
function sys.dump_database(describe boolean) returns table(o int, stmt string) 
begin set schema sys; truncate sys.dump_statements; insert into 
sys.dump_statements values (1, 'START TRANSACTION;'); insert into 
sys.dump_statements values ((select count(*) from sys.dump_statements) + 1, 
'SET SCHEMA \"sys\";'); insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_create_roles; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_create_users; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_create_schemas; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_user_defined_types; insert into sys.dump_statements 
select (select count(*) from sys.dump_statements) + rank() 
 over(), stmt from sys.dump_add_schemas_to_users; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_grant_user_privileges; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_sequences; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(order by stmts.o), 
stmts.s from (select f.o, f.stmt from sys.dump_functions f union select t.o, 
t.stmt from sys.dump_tables t) as stmts(o, s); if not describe then call 
sys.dump_table_data(); end if; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_start_sequences; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_column_defaults; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from sys
 .dump_table_constraint_type; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from sys.dump_indices; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_foreign_keys; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_partition_tables; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_triggers; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_comments; insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_table_grants; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_column_grants; insert into 
sys.dump_statements select (select count
 (*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_function_grants; insert into sys.dump_statements values ((select 
count(*) from sys.dump_statements) + 1, 'COMMIT;'); return sys.dump_statements; 
end;",      "sql",  "SQL",  "Function returning a table",   false,  false,  
false,  true,   NULL,   "o",    "int",  32,     0,      "out",  "stmt", "clob", 
0,      0,      "out",  "describe",     "boolean",      1,      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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data() begin declare i int; set i = (select min(t.id) 
from sys.tables t, sys.table_types ts where t.type = ts.table_type_id and 
ts.table_type_name = 'TABLE' and not t.system); if i is not null then declare m 
int; set m = (select max(t.id) from sys.tables t, sys.table_types ts where 
t.type = ts.table_type_id and ts.table_type_name = 'TABLE' and not t.system); 
declare sch string; declare tbl string; while i < m do set sch = (select s.name 
from sys.tables t, sys.schemas s where s.id = t.schema_id and t.id = i); set 
tbl = (select t.name from sys.tables t, sys.schemas s where s.id = t.schema_id 
and t.id = i); call sys.dump_table_data(sch, tbl); set i = (select min(t.id) 
from sys.tables t, sys.table_types ts where t.type = ts.table_type_id and 
ts.table_type_name = 'TABLE' and not t.system and t.id > i); end while; set sch 
= (select s.name from sys.tables t, sys.schemas s where s.id = t.schema_id and 
t.
 id = i); set tbl = (select t.name from sys.tables t, sys.schemas s where s.id 
= t.schema_id and t.id = i); call sys.dump_table_data(sch, tbl); end if; end;", 
 "sql",  "SQL",  "Procedure",    true,   false,  false,  true,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data(sch string, tbl string) begin declare k int; set 
k = (select min(c.id) from sys.columns c, sys.tables t, sys.schemas s where 
c.table_id = t.id and t.name = tbl and t.schema_id = s.id and s.name = sch); if 
k is not null then declare cname string; declare ctype string; set cname = 
(select c.name from sys.columns c where c.id = k); set ctype = (select c.type 
from sys.columns c where c.id = k); declare copy_into_stmt string; declare _cnt 
int; set _cnt = (select count from sys.storage(sch, tbl, cname)); if _cnt > 0 
then set copy_into_stmt = 'COPY ' || _cnt || ' RECORDS INTO ' || sys.fqn(sch, 
tbl) || '(' || sys.dq(cname); declare select_data_stmt string; set 
select_data_stmt = 'SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() 
OVER(), ' || sys.prepare_esc(cname, ctype); declare m int; set m = (select 
max(c.id) from sys.columns c, sys.tables t where c.table_id = t.id and t.name = 
tbl); whi
 le (k < m) do set k = (select min(c.id) from sys.columns c, sys.tables t where 
c.table_id = t.id and t.name = tbl and c.id > k); set cname = (select c.name 
from sys.columns c where c.id = k); set ctype = (select c.type from sys.columns 
c where c.id = k); set copy_into_stmt = (copy_into_stmt || ', ' || 
sys.dq(cname)); set select_data_stmt = select_data_stmt || '|| \\'|\\' || ' || 
sys.prepare_esc(cname, ctype); end while; set copy_into_stmt = (copy_into_stmt 
|| ') FROM STDIN USING DELIMITERS \\'|\\',E\\'\\\\n\\',\\'\"\\';'); set 
select_data_stmt = select_data_stmt || ' FROM ' || sys.fqn(sch, tbl); insert 
into sys.dump_statements values ((select count(*) from sys.dump_statements) + 
1, copy_into_stmt); call sys.eval('INSERT INTO sys.dump_statements ' || 
select_data_stmt || ';'); end if; end if; end;",       "sql",  "SQL",  
"Procedure",    true,   false,  false,  true,   NULL,   "sch",  "clob", 0,      
0,      "in",   "tbl",  "clob", 0,      0,      "in",   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NUL
 L,     NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   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",  "dump_database",        "SYSTEM",       "create 
function sys.dump_database(describe boolean) returns table(o int, stmt string) 
begin set schema sys; truncate sys.dump_statements; insert into 
sys.dump_statements values (1, 'START TRANSACTION;'); insert into 
sys.dump_statements values (2, 'SET SCHEMA \"sys\";'); insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_create_roles; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_create_users; insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_create_schemas; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_user_defined_types; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_add_schemas_to_use
 rs; insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_grant_user_privileges; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_sequences; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(order by stmts.o), stmts.s from (select f.o, f.stmt from 
sys.dump_functions f union all select t.o, t.stmt from sys.dump_tables t) as 
stmts(o, s); if not describe then call sys.dump_table_data(); end if; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_start_sequences; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_column_defaults; insert into sys.dump_statements 
select (select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_table_constraint_type; insert into 
 sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_indices; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_foreign_keys; insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_partition_tables; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_triggers; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_comments; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_table_grants; insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_column_grants; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() ov
 er(), stmt from sys.dump_function_grants; insert into sys.dump_statements 
values ((select count(*) from sys.dump_statements) + 1, 'COMMIT;'); return 
sys.dump_statements; end;",       "sql",  "SQL",  "Function returning a table", 
  false,  false,  false,  true,   NULL,   "o",    "int",  32,     0,      
"out",  "stmt", "clob", 0,      0,      "out",  "describe",     "boolean",      
1,      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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data() begin declare i int; set i = (select min(t.id) 
from sys.tables t, sys.table_types ts where t.type = ts.table_type_id and 
ts.table_type_name = 'TABLE' and not t.system); if i is not null then declare m 
int; set m = (select max(t.id) from sys.tables t, sys.table_types ts where 
t.type = ts.table_type_id and ts.table_type_name = 'TABLE' and not t.system); 
declare sch string; declare tbl string; while i is not null and i <= m do set 
sch = (select s.name from sys.tables t, sys.schemas s where s.id = t.schema_id 
and t.id = i); set tbl = (select t.name from sys.tables t, sys.schemas s where 
s.id = t.schema_id and t.id = i); call sys.dump_table_data(sch, tbl); set i = 
(select min(t.id) from sys.tables t, sys.table_types ts where t.type = 
ts.table_type_id and ts.table_type_name = 'TABLE' and not t.system and t.id > 
i); end while; end if; end;",  "sql",  "SQL",  "Procedure",    true,   false,  
false,  true,   NU
 LL,    NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data(sch string, tbl string) begin declare tid int; 
set tid = (select min(t.id) from sys.tables t, sys.schemas s where t.name = tbl 
and t.schema_id = s.id and s.name = sch); if tid is not null then declare k 
int; declare m int; set k = (select min(c.id) from sys.columns c where 
c.table_id = tid); set m = (select max(c.id) from sys.columns c where 
c.table_id = tid); if k is not null and m is not null then declare cname 
string; declare ctype string; declare _cnt int; set cname = (select c.name from 
sys.columns c where c.id = k); set ctype = (select c.type from sys.columns c 
where c.id = k); set _cnt = (select count from sys.storage(sch, tbl, cname)); 
if _cnt > 0 then declare copy_into_stmt string; declare select_data_stmt 
string; set copy_into_stmt = 'COPY ' || _cnt || ' RECORDS INTO ' || 
sys.fqn(sch, tbl) || '(' || sys.dq(cname); set select_data_stmt = 'SELECT 
(SELECT COUNT(*) FROM sys.dump_statem
 ents) + RANK() OVER(), ' || sys.prepare_esc(cname, ctype); while (k < m) do 
set k = (select min(c.id) from sys.columns c where c.table_id = tid and c.id > 
k); set cname = (select c.name from sys.columns c where c.id = k); set ctype = 
(select c.type from sys.columns c where c.id = k); set copy_into_stmt = 
(copy_into_stmt || ', ' || sys.dq(cname)); set select_data_stmt = 
(select_data_stmt || '|| \\'|\\' || ' || sys.prepare_esc(cname, ctype)); end 
while; set copy_into_stmt = (copy_into_stmt || ') FROM STDIN USING DELIMITERS 
\\'|\\',E\\'\\\\n\\',\\'\"\\';'); set select_data_stmt = (select_data_stmt || ' 
FROM ' || sys.fqn(sch, tbl)); insert into sys.dump_statements values ((select 
count(*) from sys.dump_statements) + 1, copy_into_stmt); call sys.eval('INSERT 
INTO sys.dump_statements ' || select_data_stmt || ';'); end if; end if; end if; 
end;",     "sql",  "SQL",  "Procedure",    true,   false,  false,  true,   
NULL,   "sch",  "clob", 0,      0,      "in",   "tbl",  "clob", 0,      0,      
"in",   NULL,   NULL,   NULL,   NULL,   NULL,   NUL
 L,     NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   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",  "editdistance", "SYSTEM",       "editdistance", 
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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",  "editdistance", "SYSTEM",       "editdistance", 
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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",  "editdistance", "SYSTEM",       "editdistance", 
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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    ]
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
@@ -1567,9 +1567,9 @@ select 'null in value_partitions.value',
 [ "sys.functions",     "sys",  "difference",   "SYSTEM",       "stringdiff",   
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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",  "dq",   "SYSTEM",       "create function sys.dq 
(s string) returns string begin return '\"' || sys.replace(s,'\"','\"\"') || 
'\"'; end;",       "sql",  "SQL",  "Scalar function",      false,  false,  
false,  true,   NULL,   "result",       "clob", 0,      0,      "out",  "s",    
"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",  "droporderindex",       "SYSTEM",       "create 
procedure sys.droporderindex(sys string, tab string, col string) external name 
sql.droporderindex;",    "sql",  "MAL",  "Procedure",    true,   false,  false, 
 true,   NULL,   "sys",  "clob", 0,      0,      "in",   "tab",  "clob", 0,     
 0,      "in",   "col",  "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",  "dump_database",        "SYSTEM",       "create 
function sys.dump_database(describe boolean) returns table(o int, stmt string) 
begin set schema sys; truncate sys.dump_statements; insert into 
sys.dump_statements values (1, 'START TRANSACTION;'); insert into 
sys.dump_statements values ((select count(*) from sys.dump_statements) + 1, 
'SET SCHEMA \"sys\";'); insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_create_roles; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_create_users; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_create_schemas; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_user_defined_types; insert into sys.dump_statements 
select (select count(*) from sys.dump_statements) + rank() 
 over(), stmt from sys.dump_add_schemas_to_users; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_grant_user_privileges; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_sequences; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(order by stmts.o), 
stmts.s from (select f.o, f.stmt from sys.dump_functions f union select t.o, 
t.stmt from sys.dump_tables t) as stmts(o, s); if not describe then call 
sys.dump_table_data(); end if; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_start_sequences; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_column_defaults; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from sys
 .dump_table_constraint_type; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from sys.dump_indices; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_foreign_keys; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_partition_tables; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_triggers; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_comments; insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_table_grants; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_column_grants; insert into 
sys.dump_statements select (select count
 (*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_function_grants; insert into sys.dump_statements values ((select 
count(*) from sys.dump_statements) + 1, 'COMMIT;'); return sys.dump_statements; 
end;",      "sql",  "SQL",  "Function returning a table",   false,  false,  
false,  true,   NULL,   "o",    "int",  32,     0,      "out",  "stmt", "clob", 
0,      0,      "out",  "describe",     "boolean",      1,      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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data() begin declare i int; set i = (select min(t.id) 
from sys.tables t, sys.table_types ts where t.type = ts.table_type_id and 
ts.table_type_name = 'TABLE' and not t.system); if i is not null then declare m 
int; set m = (select max(t.id) from sys.tables t, sys.table_types ts where 
t.type = ts.table_type_id and ts.table_type_name = 'TABLE' and not t.system); 
declare sch string; declare tbl string; while i < m do set sch = (select s.name 
from sys.tables t, sys.schemas s where s.id = t.schema_id and t.id = i); set 
tbl = (select t.name from sys.tables t, sys.schemas s where s.id = t.schema_id 
and t.id = i); call sys.dump_table_data(sch, tbl); set i = (select min(t.id) 
from sys.tables t, sys.table_types ts where t.type = ts.table_type_id and 
ts.table_type_name = 'TABLE' and not t.system and t.id > i); end while; set sch 
= (select s.name from sys.tables t, sys.schemas s where s.id = t.schema_id and 
t.
 id = i); set tbl = (select t.name from sys.tables t, sys.schemas s where s.id 
= t.schema_id and t.id = i); call sys.dump_table_data(sch, tbl); end if; end;", 
 "sql",  "SQL",  "Procedure",    true,   false,  false,  true,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data(sch string, tbl string) begin declare k int; set 
k = (select min(c.id) from sys.columns c, sys.tables t, sys.schemas s where 
c.table_id = t.id and t.name = tbl and t.schema_id = s.id and s.name = sch); if 
k is not null then declare cname string; declare ctype string; set cname = 
(select c.name from sys.columns c where c.id = k); set ctype = (select c.type 
from sys.columns c where c.id = k); declare copy_into_stmt string; declare _cnt 
int; set _cnt = (select count from sys.storage(sch, tbl, cname)); if _cnt > 0 
then set copy_into_stmt = 'COPY ' || _cnt || ' RECORDS INTO ' || sys.fqn(sch, 
tbl) || '(' || sys.dq(cname); declare select_data_stmt string; set 
select_data_stmt = 'SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() 
OVER(), ' || sys.prepare_esc(cname, ctype); declare m int; set m = (select 
max(c.id) from sys.columns c, sys.tables t where c.table_id = t.id and t.name = 
tbl); whi
 le (k < m) do set k = (select min(c.id) from sys.columns c, sys.tables t where 
c.table_id = t.id and t.name = tbl and c.id > k); set cname = (select c.name 
from sys.columns c where c.id = k); set ctype = (select c.type from sys.columns 
c where c.id = k); set copy_into_stmt = (copy_into_stmt || ', ' || 
sys.dq(cname)); set select_data_stmt = select_data_stmt || '|| \\'|\\' || ' || 
sys.prepare_esc(cname, ctype); end while; set copy_into_stmt = (copy_into_stmt 
|| ') FROM STDIN USING DELIMITERS \\'|\\',E\\'\\\\n\\',\\'\"\\';'); set 
select_data_stmt = select_data_stmt || ' FROM ' || sys.fqn(sch, tbl); insert 
into sys.dump_statements values ((select count(*) from sys.dump_statements) + 
1, copy_into_stmt); call sys.eval('INSERT INTO sys.dump_statements ' || 
select_data_stmt || ';'); end if; end if; end;",       "sql",  "SQL",  
"Procedure",    true,   false,  false,  true,   NULL,   "sch",  "clob", 0,      
0,      "in",   "tbl",  "clob", 0,      0,      "in",   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NUL
 L,     NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   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",  "dump_database",        "SYSTEM",       "create 
function sys.dump_database(describe boolean) returns table(o int, stmt string) 
begin set schema sys; truncate sys.dump_statements; insert into 
sys.dump_statements values (1, 'START TRANSACTION;'); insert into 
sys.dump_statements values (2, 'SET SCHEMA \"sys\";'); insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_create_roles; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_create_users; insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_create_schemas; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_user_defined_types; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_add_schemas_to_use
 rs; insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_grant_user_privileges; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_sequences; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(order by stmts.o), stmts.s from (select f.o, f.stmt from 
sys.dump_functions f union all select t.o, t.stmt from sys.dump_tables t) as 
stmts(o, s); if not describe then call sys.dump_table_data(); end if; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_start_sequences; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_column_defaults; insert into sys.dump_statements 
select (select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_table_constraint_type; insert into 
 sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_indices; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_foreign_keys; insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_partition_tables; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_triggers; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_comments; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_table_grants; insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_column_grants; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() ov
 er(), stmt from sys.dump_function_grants; insert into sys.dump_statements 
values ((select count(*) from sys.dump_statements) + 1, 'COMMIT;'); return 
sys.dump_statements; end;",       "sql",  "SQL",  "Function returning a table", 
  false,  false,  false,  true,   NULL,   "o",    "int",  32,     0,      
"out",  "stmt", "clob", 0,      0,      "out",  "describe",     "boolean",      
1,      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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data() begin declare i int; set i = (select min(t.id) 
from sys.tables t, sys.table_types ts where t.type = ts.table_type_id and 
ts.table_type_name = 'TABLE' and not t.system); if i is not null then declare m 
int; set m = (select max(t.id) from sys.tables t, sys.table_types ts where 
t.type = ts.table_type_id and ts.table_type_name = 'TABLE' and not t.system); 
declare sch string; declare tbl string; while i is not null and i <= m do set 
sch = (select s.name from sys.tables t, sys.schemas s where s.id = t.schema_id 
and t.id = i); set tbl = (select t.name from sys.tables t, sys.schemas s where 
s.id = t.schema_id and t.id = i); call sys.dump_table_data(sch, tbl); set i = 
(select min(t.id) from sys.tables t, sys.table_types ts where t.type = 
ts.table_type_id and ts.table_type_name = 'TABLE' and not t.system and t.id > 
i); end while; end if; end;",  "sql",  "SQL",  "Procedure",    true,   false,  
false,  true,   NU
 LL,    NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data(sch string, tbl string) begin declare tid int; 
set tid = (select min(t.id) from sys.tables t, sys.schemas s where t.name = tbl 
and t.schema_id = s.id and s.name = sch); if tid is not null then declare k 
int; declare m int; set k = (select min(c.id) from sys.columns c where 
c.table_id = tid); set m = (select max(c.id) from sys.columns c where 
c.table_id = tid); if k is not null and m is not null then declare cname 
string; declare ctype string; declare _cnt int; set cname = (select c.name from 
sys.columns c where c.id = k); set ctype = (select c.type from sys.columns c 
where c.id = k); set _cnt = (select count from sys.storage(sch, tbl, cname)); 
if _cnt > 0 then declare copy_into_stmt string; declare select_data_stmt 
string; set copy_into_stmt = 'COPY ' || _cnt || ' RECORDS INTO ' || 
sys.fqn(sch, tbl) || '(' || sys.dq(cname); set select_data_stmt = 'SELECT 
(SELECT COUNT(*) FROM sys.dump_statem
 ents) + RANK() OVER(), ' || sys.prepare_esc(cname, ctype); while (k < m) do 
set k = (select min(c.id) from sys.columns c where c.table_id = tid and c.id > 
k); set cname = (select c.name from sys.columns c where c.id = k); set ctype = 
(select c.type from sys.columns c where c.id = k); set copy_into_stmt = 
(copy_into_stmt || ', ' || sys.dq(cname)); set select_data_stmt = 
(select_data_stmt || '|| \\'|\\' || ' || sys.prepare_esc(cname, ctype)); end 
while; set copy_into_stmt = (copy_into_stmt || ') FROM STDIN USING DELIMITERS 
\\'|\\',E\\'\\\\n\\',\\'\"\\';'); set select_data_stmt = (select_data_stmt || ' 
FROM ' || sys.fqn(sch, tbl)); insert into sys.dump_statements values ((select 
count(*) from sys.dump_statements) + 1, copy_into_stmt); call sys.eval('INSERT 
INTO sys.dump_statements ' || select_data_stmt || ';'); end if; end if; end if; 
end;",     "sql",  "SQL",  "Procedure",    true,   false,  false,  true,   
NULL,   "sch",  "clob", 0,      0,      "in",   "tbl",  "clob", 0,      0,      
"in",   NULL,   NULL,   NULL,   NULL,   NULL,   NUL
 L,     NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   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",  "editdistance", "SYSTEM",       "editdistance", 
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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",  "editdistance", "SYSTEM",       "editdistance", 
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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",  "editdistance", "SYSTEM",       "editdistance", 
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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    ]
diff --git a/sql/test/emptydb/Tests/check.stable.out.int128 
b/sql/test/emptydb/Tests/check.stable.out.int128
--- a/sql/test/emptydb/Tests/check.stable.out.int128
+++ b/sql/test/emptydb/Tests/check.stable.out.int128
@@ -1584,9 +1584,9 @@ select 'null in value_partitions.value',
 [ "sys.functions",     "sys",  "difference",   "SYSTEM",       "stringdiff",   
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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",  "dq",   "SYSTEM",       "create function sys.dq 
(s string) returns string begin return '\"' || sys.replace(s,'\"','\"\"') || 
'\"'; end;",       "sql",  "SQL",  "Scalar function",      false,  false,  
false,  true,   NULL,   "result",       "clob", 0,      0,      "out",  "s",    
"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",  "droporderindex",       "SYSTEM",       "create 
procedure sys.droporderindex(sys string, tab string, col string) external name 
sql.droporderindex;",    "sql",  "MAL",  "Procedure",    true,   false,  false, 
 true,   NULL,   "sys",  "clob", 0,      0,      "in",   "tab",  "clob", 0,     
 0,      "in",   "col",  "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",  "dump_database",        "SYSTEM",       "create 
function sys.dump_database(describe boolean) returns table(o int, stmt string) 
begin set schema sys; truncate sys.dump_statements; insert into 
sys.dump_statements values (1, 'START TRANSACTION;'); insert into 
sys.dump_statements values ((select count(*) from sys.dump_statements) + 1, 
'SET SCHEMA \"sys\";'); insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_create_roles; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_create_users; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_create_schemas; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_user_defined_types; insert into sys.dump_statements 
select (select count(*) from sys.dump_statements) + rank() 
 over(), stmt from sys.dump_add_schemas_to_users; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_grant_user_privileges; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_sequences; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(order by stmts.o), 
stmts.s from (select f.o, f.stmt from sys.dump_functions f union select t.o, 
t.stmt from sys.dump_tables t) as stmts(o, s); if not describe then call 
sys.dump_table_data(); end if; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_start_sequences; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_column_defaults; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from sys
 .dump_table_constraint_type; insert into sys.dump_statements select (select 
count(*) from sys.dump_statements) + rank() over(), stmt from sys.dump_indices; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_foreign_keys; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_partition_tables; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_triggers; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_comments; insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_table_grants; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_column_grants; insert into 
sys.dump_statements select (select count
 (*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_function_grants; insert into sys.dump_statements values ((select 
count(*) from sys.dump_statements) + 1, 'COMMIT;'); return sys.dump_statements; 
end;",      "sql",  "SQL",  "Function returning a table",   false,  false,  
false,  true,   NULL,   "o",    "int",  32,     0,      "out",  "stmt", "clob", 
0,      0,      "out",  "describe",     "boolean",      1,      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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data() begin declare i int; set i = (select min(t.id) 
from sys.tables t, sys.table_types ts where t.type = ts.table_type_id and 
ts.table_type_name = 'TABLE' and not t.system); if i is not null then declare m 
int; set m = (select max(t.id) from sys.tables t, sys.table_types ts where 
t.type = ts.table_type_id and ts.table_type_name = 'TABLE' and not t.system); 
declare sch string; declare tbl string; while i < m do set sch = (select s.name 
from sys.tables t, sys.schemas s where s.id = t.schema_id and t.id = i); set 
tbl = (select t.name from sys.tables t, sys.schemas s where s.id = t.schema_id 
and t.id = i); call sys.dump_table_data(sch, tbl); set i = (select min(t.id) 
from sys.tables t, sys.table_types ts where t.type = ts.table_type_id and 
ts.table_type_name = 'TABLE' and not t.system and t.id > i); end while; set sch 
= (select s.name from sys.tables t, sys.schemas s where s.id = t.schema_id and 
t.
 id = i); set tbl = (select t.name from sys.tables t, sys.schemas s where s.id 
= t.schema_id and t.id = i); call sys.dump_table_data(sch, tbl); end if; end;", 
 "sql",  "SQL",  "Procedure",    true,   false,  false,  true,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,  
 NULL,   NULL,   NULL,   NULL,   NULL,   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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data(sch string, tbl string) begin declare k int; set 
k = (select min(c.id) from sys.columns c, sys.tables t, sys.schemas s where 
c.table_id = t.id and t.name = tbl and t.schema_id = s.id and s.name = sch); if 
k is not null then declare cname string; declare ctype string; set cname = 
(select c.name from sys.columns c where c.id = k); set ctype = (select c.type 
from sys.columns c where c.id = k); declare copy_into_stmt string; declare _cnt 
int; set _cnt = (select count from sys.storage(sch, tbl, cname)); if _cnt > 0 
then set copy_into_stmt = 'COPY ' || _cnt || ' RECORDS INTO ' || sys.fqn(sch, 
tbl) || '(' || sys.dq(cname); declare select_data_stmt string; set 
select_data_stmt = 'SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() 
OVER(), ' || sys.prepare_esc(cname, ctype); declare m int; set m = (select 
max(c.id) from sys.columns c, sys.tables t where c.table_id = t.id and t.name = 
tbl); whi
 le (k < m) do set k = (select min(c.id) from sys.columns c, sys.tables t where 
c.table_id = t.id and t.name = tbl and c.id > k); set cname = (select c.name 
from sys.columns c where c.id = k); set ctype = (select c.type from sys.columns 
c where c.id = k); set copy_into_stmt = (copy_into_stmt || ', ' || 
sys.dq(cname)); set select_data_stmt = select_data_stmt || '|| \\'|\\' || ' || 
sys.prepare_esc(cname, ctype); end while; set copy_into_stmt = (copy_into_stmt 
|| ') FROM STDIN USING DELIMITERS \\'|\\',E\\'\\\\n\\',\\'\"\\';'); set 
select_data_stmt = select_data_stmt || ' FROM ' || sys.fqn(sch, tbl); insert 
into sys.dump_statements values ((select count(*) from sys.dump_statements) + 
1, copy_into_stmt); call sys.eval('INSERT INTO sys.dump_statements ' || 
select_data_stmt || ';'); end if; end if; end;",       "sql",  "SQL",  
"Procedure",    true,   false,  false,  true,   NULL,   "sch",  "clob", 0,      
0,      "in",   "tbl",  "clob", 0,      0,      "in",   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NUL
 L,     NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   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",  "dump_database",        "SYSTEM",       "create 
function sys.dump_database(describe boolean) returns table(o int, stmt string) 
begin set schema sys; truncate sys.dump_statements; insert into 
sys.dump_statements values (1, 'START TRANSACTION;'); insert into 
sys.dump_statements values (2, 'SET SCHEMA \"sys\";'); insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_create_roles; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_create_users; insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_create_schemas; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_user_defined_types; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_add_schemas_to_use
 rs; insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_grant_user_privileges; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_sequences; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(order by stmts.o), stmts.s from (select f.o, f.stmt from 
sys.dump_functions f union all select t.o, t.stmt from sys.dump_tables t) as 
stmts(o, s); if not describe then call sys.dump_table_data(); end if; insert 
into sys.dump_statements select (select count(*) from sys.dump_statements) + 
rank() over(), stmt from sys.dump_start_sequences; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_column_defaults; insert into sys.dump_statements 
select (select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_table_constraint_type; insert into 
 sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_indices; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_foreign_keys; insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_partition_tables; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() over(), stmt from sys.dump_triggers; insert into 
sys.dump_statements select (select count(*) from sys.dump_statements) + rank() 
over(), stmt from sys.dump_comments; insert into sys.dump_statements select 
(select count(*) from sys.dump_statements) + rank() over(), stmt from 
sys.dump_table_grants; insert into sys.dump_statements select (select count(*) 
from sys.dump_statements) + rank() over(), stmt from sys.dump_column_grants; 
insert into sys.dump_statements select (select count(*) from 
sys.dump_statements) + rank() ov
 er(), stmt from sys.dump_function_grants; insert into sys.dump_statements 
values ((select count(*) from sys.dump_statements) + 1, 'COMMIT;'); return 
sys.dump_statements; end;",       "sql",  "SQL",  "Function returning a table", 
  false,  false,  false,  true,   NULL,   "o",    "int",  32,     0,      
"out",  "stmt", "clob", 0,      0,      "out",  "describe",     "boolean",      
1,      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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data() begin declare i int; set i = (select min(t.id) 
from sys.tables t, sys.table_types ts where t.type = ts.table_type_id and 
ts.table_type_name = 'TABLE' and not t.system); if i is not null then declare m 
int; set m = (select max(t.id) from sys.tables t, sys.table_types ts where 
t.type = ts.table_type_id and ts.table_type_name = 'TABLE' and not t.system); 
declare sch string; declare tbl string; while i is not null and i <= m do set 
sch = (select s.name from sys.tables t, sys.schemas s where s.id = t.schema_id 
and t.id = i); set tbl = (select t.name from sys.tables t, sys.schemas s where 
s.id = t.schema_id and t.id = i); call sys.dump_table_data(sch, tbl); set i = 
(select min(t.id) from sys.tables t, sys.table_types ts where t.type = 
ts.table_type_id and ts.table_type_name = 'TABLE' and not t.system and t.id > 
i); end while; end if; end;",  "sql",  "SQL",  "Procedure",    true,   false,  
false,  true,   NU
 LL,    NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   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",  "dump_table_data",      "SYSTEM",       "create 
procedure sys.dump_table_data(sch string, tbl string) begin declare tid int; 
set tid = (select min(t.id) from sys.tables t, sys.schemas s where t.name = tbl 
and t.schema_id = s.id and s.name = sch); if tid is not null then declare k 
int; declare m int; set k = (select min(c.id) from sys.columns c where 
c.table_id = tid); set m = (select max(c.id) from sys.columns c where 
c.table_id = tid); if k is not null and m is not null then declare cname 
string; declare ctype string; declare _cnt int; set cname = (select c.name from 
sys.columns c where c.id = k); set ctype = (select c.type from sys.columns c 
where c.id = k); set _cnt = (select count from sys.storage(sch, tbl, cname)); 
if _cnt > 0 then declare copy_into_stmt string; declare select_data_stmt 
string; set copy_into_stmt = 'COPY ' || _cnt || ' RECORDS INTO ' || 
sys.fqn(sch, tbl) || '(' || sys.dq(cname); set select_data_stmt = 'SELECT 
(SELECT COUNT(*) FROM sys.dump_statem
 ents) + RANK() OVER(), ' || sys.prepare_esc(cname, ctype); while (k < m) do 
set k = (select min(c.id) from sys.columns c where c.table_id = tid and c.id > 
k); set cname = (select c.name from sys.columns c where c.id = k); set ctype = 
(select c.type from sys.columns c where c.id = k); set copy_into_stmt = 
(copy_into_stmt || ', ' || sys.dq(cname)); set select_data_stmt = 
(select_data_stmt || '|| \\'|\\' || ' || sys.prepare_esc(cname, ctype)); end 
while; set copy_into_stmt = (copy_into_stmt || ') FROM STDIN USING DELIMITERS 
\\'|\\',E\\'\\\\n\\',\\'\"\\';'); set select_data_stmt = (select_data_stmt || ' 
FROM ' || sys.fqn(sch, tbl)); insert into sys.dump_statements values ((select 
count(*) from sys.dump_statements) + 1, copy_into_stmt); call sys.eval('INSERT 
INTO sys.dump_statements ' || select_data_stmt || ';'); end if; end if; end if; 
end;",     "sql",  "SQL",  "Procedure",    true,   false,  false,  true,   
NULL,   "sch",  "clob", 0,      0,      "in",   "tbl",  "clob", 0,      0,      
"in",   NULL,   NULL,   NULL,   NULL,   NULL,   NUL
 L,     NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   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",  "editdistance", "SYSTEM",       "editdistance", 
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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",  "editdistance", "SYSTEM",       "editdistance", 
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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",  "editdistance", "SYSTEM",       "editdistance", 
"txtsim",       "Internal C",   "Scalar function",      false,  false,  false,  
true,   NULL,   "res_0",        "int",  32,     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    ]
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to