Changeset: 93b20503da17 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/93b20503da17
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
        testing/Mtest.py.in
Branch: default
Log Message:

Merge with Dec2025 branch.


diffs (187 lines):

diff --git a/sql/test/emptydb/Tests/check.SQL.py 
b/sql/test/emptydb/Tests/check.SQL.py
--- a/sql/test/emptydb/Tests/check.SQL.py
+++ b/sql/test/emptydb/Tests/check.SQL.py
@@ -446,12 +446,10 @@ sys_notnull = [
 # they are too volatile, and if it makes sense, dump an identifier
 # from a referenced table
 out = r'''
--- helper function
-create function pcre_replace(origin string, pat string, repl string, flags 
string) returns string external name pcre.replace;
 -- schemas
 select 'sys.schemas', s.name, a1.name as authorization, a2.name as owner, 
system, c.remark as comment from sys.schemas s left outer join sys.auths a1 on 
s.authorization = a1.id left outer join sys.auths a2 on s.owner = a2.id left 
outer join sys.comments c on c.id = s.id order by s.name;
 -- _tables
-select 'sys._tables', s.name, t.name, 
replace(replace(pcre_replace(pcre_replace(t.query, E'--.*\n*', '', ''), E'[ 
\t\n]+', ' ', ''), '( ', '('), ' )', ')') as query, tt.table_type_name as type, 
t.system, ca.action_name as commit_action, at.value as access, c.remark as 
comment from sys._tables t left outer join sys.schemas s on t.schema_id = s.id 
left outer join sys.table_types tt on t.type = tt.table_type_id left outer join 
(values (0, 'COMMIT'), (1, 'DELETE'), (2, 'PRESERVE'), (3, 'DROP'), (4, 
'ABORT')) as ca (action_id, action_name) on t.commit_action = ca.action_id left 
outer join (values (0, 'WRITABLE'), (1, 'READONLY'), (2, 'APPENDONLY')) as at 
(id, value) on t.access = at.id left outer join sys.comments c on c.id = t.id 
order by s.name, t.name;
+select 'sys._tables', s.name, t.name, 
replace(replace(sys.regexp_replace(sys.regexp_replace(t.query, E'--.*\n*', '', 
''), E'[ \t\n]+', ' ', ''), '( ', '('), ' )', ')') as query, tt.table_type_name 
as type, t.system, ca.action_name as commit_action, at.value as access, 
c.remark as comment from sys._tables t left outer join sys.schemas s on 
t.schema_id = s.id left outer join sys.table_types tt on t.type = 
tt.table_type_id left outer join (values (0, 'COMMIT'), (1, 'DELETE'), (2, 
'PRESERVE'), (3, 'DROP'), (4, 'ABORT')) as ca (action_id, action_name) on 
t.commit_action = ca.action_id left outer join (values (0, 'WRITABLE'), (1, 
'READONLY'), (2, 'APPENDONLY')) as at (id, value) on t.access = at.id left 
outer join sys.comments c on c.id = t.id order by s.name, t.name;
 -- _columns
 select 'sys._columns', s.name, t.name, c.name, c.type, c.type_digits, 
c.type_scale, c."default", c."null", c.number, c.storage, r.remark as comment 
from sys.schemas s, sys._tables t, sys._columns c left outer join sys.comments 
r on r.id = c.id where s.id = t.schema_id and t.id = c.table_id order by 
s.name, t.name, c.number;
 -- partitioned tables (these three should be empty)
@@ -459,7 +457,7 @@ select 'sys.table_partitions', t.name, c
 select 'sys.range_partitions', t.name, p.expression, r.minimum, r.maximum, 
r.with_nulls from sys.range_partitions r left outer join sys._tables t on t.id 
= r.table_id left outer join sys.table_partitions p on r.partition_id = p.id;
 select 'sys.value_partitions', t.name, p.expression, v.value from 
sys.value_partitions v left outer join sys._tables t on t.id = v.table_id left 
outer join sys.table_partitions p on v.partition_id = p.id;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with funcs as (select name, pcre_replace(func, E'--.*\n*', '', '') as func, 
schema_id from sys.functions), x (sname, name, modfunc) as (select s.name, 
f.name, replace(pcre_replace(f.func, '.*external name (.*);.*', '$1', 'ims'), 
'"', '') from funcs f left outer join sys.schemas s on f.schema_id = s.id where 
f.func ilike '% external name %') select 'dangling external functions', * from 
x where x.modfunc not in (select m.module || '.' || m."function" from 
sys.malfunctions() m);
+with funcs as (select name, sys.regexp_replace(func, E'--.*\n*', '', '') as 
func, schema_id from sys.functions), x (sname, name, modfunc) as (select 
s.name, f.name, replace(sys.regexp_replace(f.func, '.*external name (.*);.*', 
'$1', 'ims'), '"', '') from funcs f left outer join sys.schemas s on 
f.schema_id = s.id where f.func ilike '% external name %') select 'dangling 
external functions', * from x where x.modfunc not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
 -- args
 '''
 # generate a monster query to get all functions with all their
@@ -472,7 +470,7 @@ MAXARGS = 16
 # columns of the args table we're interested in
 args = ['name', 'type', 'type_digits', 'type_scale', 'inout']
 
-out += r"select 'sys.functions', s.name, f.name, case f.system when true then 
'SYSTEM' else '' end as system, 
replace(replace(replace(pcre_replace(pcre_replace(pcre_replace(f.func, 
E'--.*\n', '', ''), E'[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', 
')'), 'create system ', 'create ') as query, f.mod, fl.language_name, 
ft.function_type_name as func_type, f.side_effect, f.varres, f.vararg, 
f.semantics, c.remark as comment"
+out += r"select 'sys.functions', s.name, f.name, case f.system when true then 
'SYSTEM' else '' end as system, 
replace(replace(replace(sys.regexp_replace(sys.regexp_replace(sys.regexp_replace(f.func,
 E'--.*\n', '', ''), E'[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', 
')'), 'create system ', 'create ') as query, f.mod, fl.language_name, 
ft.function_type_name as func_type, f.side_effect, f.varres, f.vararg, 
f.semantics, c.remark as comment"
 for i in range(0, MAXARGS):
     for a in args[:-1]:
         out += ", a%d.%s as %s%d" % (i, a, a, i)
@@ -548,8 +546,6 @@ select 'sys.index_types', index_type_nam
 select 'sys.privilege_codes', privilege_code_name from sys.privilege_codes 
order by privilege_code_name;
 -- dependency_types
 select 'sys.dependency_types', dependency_type_id, dependency_type_name from 
sys.dependency_types order by dependency_type_id, dependency_type_name;
--- drop helper function
-drop function pcre_replace(string, string, string, string);
 '''
 
 for table, columns in sys_pkeys:
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
@@ -1,10 +1,8 @@
 
--- helper function
-create function pcre_replace(origin string, pat string, repl string, flags 
string) returns string external name pcre.replace;
 -- schemas
 select 'sys.schemas', s.name, a1.name as authorization, a2.name as owner, 
system, c.remark as comment from sys.schemas s left outer join sys.auths a1 on 
s.authorization = a1.id left outer join sys.auths a2 on s.owner = a2.id left 
outer join sys.comments c on c.id = s.id order by s.name;
 -- _tables
-select 'sys._tables', s.name, t.name, 
replace(replace(pcre_replace(pcre_replace(t.query, E'--.*\n*', '', ''), E'[ 
\t\n]+', ' ', ''), '( ', '('), ' )', ')') as query, tt.table_type_name as type, 
t.system, ca.action_name as commit_action, at.value as access, c.remark as 
comment from sys._tables t left outer join sys.schemas s on t.schema_id = s.id 
left outer join sys.table_types tt on t.type = tt.table_type_id left outer join 
(values (0, 'COMMIT'), (1, 'DELETE'), (2, 'PRESERVE'), (3, 'DROP'), (4, 
'ABORT')) as ca (action_id, action_name) on t.commit_action = ca.action_id left 
outer join (values (0, 'WRITABLE'), (1, 'READONLY'), (2, 'APPENDONLY')) as at 
(id, value) on t.access = at.id left outer join sys.comments c on c.id = t.id 
order by s.name, t.name;
+select 'sys._tables', s.name, t.name, 
replace(replace(sys.regexp_replace(sys.regexp_replace(t.query, E'--.*\n*', '', 
''), E'[ \t\n]+', ' ', ''), '( ', '('), ' )', ')') as query, tt.table_type_name 
as type, t.system, ca.action_name as commit_action, at.value as access, 
c.remark as comment from sys._tables t left outer join sys.schemas s on 
t.schema_id = s.id left outer join sys.table_types tt on t.type = 
tt.table_type_id left outer join (values (0, 'COMMIT'), (1, 'DELETE'), (2, 
'PRESERVE'), (3, 'DROP'), (4, 'ABORT')) as ca (action_id, action_name) on 
t.commit_action = ca.action_id left outer join (values (0, 'WRITABLE'), (1, 
'READONLY'), (2, 'APPENDONLY')) as at (id, value) on t.access = at.id left 
outer join sys.comments c on c.id = t.id order by s.name, t.name;
 -- _columns
 select 'sys._columns', s.name, t.name, c.name, c.type, c.type_digits, 
c.type_scale, c."default", c."null", c.number, c.storage, r.remark as comment 
from sys.schemas s, sys._tables t, sys._columns c left outer join sys.comments 
r on r.id = c.id where s.id = t.schema_id and t.id = c.table_id order by 
s.name, t.name, c.number;
 -- partitioned tables (these three should be empty)
@@ -12,9 +10,9 @@ select 'sys.table_partitions', t.name, c
 select 'sys.range_partitions', t.name, p.expression, r.minimum, r.maximum, 
r.with_nulls from sys.range_partitions r left outer join sys._tables t on t.id 
= r.table_id left outer join sys.table_partitions p on r.partition_id = p.id;
 select 'sys.value_partitions', t.name, p.expression, v.value from 
sys.value_partitions v left outer join sys._tables t on t.id = v.table_id left 
outer join sys.table_partitions p on v.partition_id = p.id;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with funcs as (select name, pcre_replace(func, E'--.*\n*', '', '') as func, 
schema_id from sys.functions), x (sname, name, modfunc) as (select s.name, 
f.name, replace(pcre_replace(f.func, '.*external name (.*);.*', '$1', 'ims'), 
'"', '') from funcs f left outer join sys.schemas s on f.schema_id = s.id where 
f.func ilike '% external name %') select 'dangling external functions', * from 
x where x.modfunc not in (select m.module || '.' || m."function" from 
sys.malfunctions() m);
+with funcs as (select name, sys.regexp_replace(func, E'--.*\n*', '', '') as 
func, schema_id from sys.functions), x (sname, name, modfunc) as (select 
s.name, f.name, replace(sys.regexp_replace(f.func, '.*external name (.*);.*', 
'$1', 'ims'), '"', '') from funcs f left outer join sys.schemas s on 
f.schema_id = s.id where f.func ilike '% external name %') select 'dangling 
external functions', * from x where x.modfunc not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
 -- args
-select 'sys.functions', s.name, f.name, case f.system when true then 'SYSTEM' 
else '' end as system, 
replace(replace(replace(pcre_replace(pcre_replace(pcre_replace(f.func, 
E'--.*\n', '', ''), E'[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', 
')'), 'create system ', 'create ') as query, f.mod, fl.language_name, 
ft.function_type_name as func_type, f.side_effect, f.varres, f.vararg, 
f.semantics, c.remark as comment, a0.name as name0, a0.type as type0, 
a0.type_digits as type_digits0, a0.type_scale as type_scale0, case a0.inout 
when 0 then 'out' when 1 then 'in' end as inout0, a1.name as name1, a1.type as 
type1, a1.type_digits as type_digits1, a1.type_scale as type_scale1, case 
a1.inout when 0 then 'out' when 1 then 'in' end as inout1, a2.name as name2, 
a2.type as type2, a2.type_digits as type_digits2, a2.type_scale as type_scale2, 
case a2.inout when 0 then 'out' when 1 then 'in' end as inout2, a3.name as 
name3, a3.type as type3, a3.type_digits as type_digits3, a3.type_scale as ty
 pe_scale3, case a3.inout when 0 then 'out' when 1 then 'in' end as inout3, 
a4.name as name4, a4.type as type4, a4.type_digits as type_digits4, 
a4.type_scale as type_scale4, case a4.inout when 0 then 'out' when 1 then 'in' 
end as inout4, a5.name as name5, a5.type as type5, a5.type_digits as 
type_digits5, a5.type_scale as type_scale5, case a5.inout when 0 then 'out' 
when 1 then 'in' end as inout5, a6.name as name6, a6.type as type6, 
a6.type_digits as type_digits6, a6.type_scale as type_scale6, case a6.inout 
when 0 then 'out' when 1 then 'in' end as inout6, a7.name as name7, a7.type as 
type7, a7.type_digits as type_digits7, a7.type_scale as type_scale7, case 
a7.inout when 0 then 'out' when 1 then 'in' end as inout7, a8.name as name8, 
a8.type as type8, a8.type_digits as type_digits8, a8.type_scale as type_scale8, 
case a8.inout when 0 then 'out' when 1 then 'in' end as inout8, a9.name as 
name9, a9.type as type9, a9.type_digits as type_digits9, a9.type_scale as 
type_scale9, case a9.inout 
 when 0 then 'out' when 1 then 'in' end as inout9, a10.name as name10, a10.type 
as type10, a10.type_digits as type_digits10, a10.type_scale as type_scale10, 
case a10.inout when 0 then 'out' when 1 then 'in' end as inout10, a11.name as 
name11, a11.type as type11, a11.type_digits as type_digits11, a11.type_scale as 
type_scale11, case a11.inout when 0 then 'out' when 1 then 'in' end as inout11, 
a12.name as name12, a12.type as type12, a12.type_digits as type_digits12, 
a12.type_scale as type_scale12, case a12.inout when 0 then 'out' when 1 then 
'in' end as inout12, a13.name as name13, a13.type as type13, a13.type_digits as 
type_digits13, a13.type_scale as type_scale13, case a13.inout when 0 then 'out' 
when 1 then 'in' end as inout13, a14.name as name14, a14.type as type14, 
a14.type_digits as type_digits14, a14.type_scale as type_scale14, case 
a14.inout when 0 then 'out' when 1 then 'in' end as inout14, a15.name as 
name15, a15.type as type15, a15.type_digits as type_digits15, a15.type_scal
 e as type_scale15, case a15.inout when 0 then 'out' when 1 then 'in' end as 
inout15 from sys.functions f left outer join sys.schemas s on f.schema_id = 
s.id left outer join sys.function_types as ft on f.type = ft.function_type_id 
left outer join sys.function_languages fl on f.language = fl.language_id left 
outer join sys.comments c on c.id = f.id left outer join sys.args a0 on 
a0.func_id = f.id and a0.number = 0 left outer join sys.args a1 on a1.func_id = 
f.id and a1.number = 1 left outer join sys.args a2 on a2.func_id = f.id and 
a2.number = 2 left outer join sys.args a3 on a3.func_id = f.id and a3.number = 
3 left outer join sys.args a4 on a4.func_id = f.id and a4.number = 4 left outer 
join sys.args a5 on a5.func_id = f.id and a5.number = 5 left outer join 
sys.args a6 on a6.func_id = f.id and a6.number = 6 left outer join sys.args a7 
on a7.func_id = f.id and a7.number = 7 left outer join sys.args a8 on 
a8.func_id = f.id and a8.number = 8 left outer join sys.args a9 on a9.func_id = 
f
 .id and a9.number = 9 left outer join sys.args a10 on a10.func_id = f.id and 
a10.number = 10 left outer join sys.args a11 on a11.func_id = f.id and 
a11.number = 11 left outer join sys.args a12 on a12.func_id = f.id and 
a12.number = 12 left outer join sys.args a13 on a13.func_id = f.id and 
a13.number = 13 left outer join sys.args a14 on a14.func_id = f.id and 
a14.number = 14 left outer join sys.args a15 on a15.func_id = f.id and 
a15.number = 15 order by s.name, f.name, query, func_type, name0 nulls first, 
type0 nulls first, type_digits0 nulls first, type_scale0 nulls first, inout0 
nulls first, name1 nulls first, type1 nulls first, type_digits1 nulls first, 
type_scale1 nulls first, inout1 nulls first, name2 nulls first, type2 nulls 
first, type_digits2 nulls first, type_scale2 nulls first, inout2 nulls first, 
name3 nulls first, type3 nulls first, type_digits3 nulls first, type_scale3 
nulls first, inout3 nulls first, name4 nulls first, type4 nulls first, 
type_digits4 nulls first, type_s
 cale4 nulls first, inout4 nulls first, name5 nulls first, type5 nulls first, 
type_digits5 nulls first, type_scale5 nulls first, inout5 nulls first, name6 
nulls first, type6 nulls first, type_digits6 nulls first, type_scale6 nulls 
first, inout6 nulls first, name7 nulls first, type7 nulls first, type_digits7 
nulls first, type_scale7 nulls first, inout7 nulls first, name8 nulls first, 
type8 nulls first, type_digits8 nulls first, type_scale8 nulls first, inout8 
nulls first, name9 nulls first, type9 nulls first, type_digits9 nulls first, 
type_scale9 nulls first, inout9 nulls first, name10 nulls first, type10 nulls 
first, type_digits10 nulls first, type_scale10 nulls first, inout10 nulls 
first, name11 nulls first, type11 nulls first, type_digits11 nulls first, 
type_scale11 nulls first, inout11 nulls first, name12 nulls first, type12 nulls 
first, type_digits12 nulls first, type_scale12 nulls first, inout12 nulls 
first, name13 nulls first, type13 nulls first, type_digits13 nulls first, type
 _scale13 nulls first, inout13 nulls first, name14 nulls first, type14 nulls 
first, type_digits14 nulls first, type_scale14 nulls first, inout14 nulls 
first, name15 nulls first, type15 nulls first, type_digits15 nulls first, 
type_scale15 nulls first, inout15 nulls first;
+select 'sys.functions', s.name, f.name, case f.system when true then 'SYSTEM' 
else '' end as system, 
replace(replace(replace(sys.regexp_replace(sys.regexp_replace(sys.regexp_replace(f.func,
 E'--.*\n', '', ''), E'[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', 
')'), 'create system ', 'create ') as query, f.mod, fl.language_name, 
ft.function_type_name as func_type, f.side_effect, f.varres, f.vararg, 
f.semantics, c.remark as comment, a0.name as name0, a0.type as type0, 
a0.type_digits as type_digits0, a0.type_scale as type_scale0, case a0.inout 
when 0 then 'out' when 1 then 'in' end as inout0, a1.name as name1, a1.type as 
type1, a1.type_digits as type_digits1, a1.type_scale as type_scale1, case 
a1.inout when 0 then 'out' when 1 then 'in' end as inout1, a2.name as name2, 
a2.type as type2, a2.type_digits as type_digits2, a2.type_scale as type_scale2, 
case a2.inout when 0 then 'out' when 1 then 'in' end as inout2, a3.name as 
name3, a3.type as type3, a3.type_digits as type_digits3, a
 3.type_scale as type_scale3, case a3.inout when 0 then 'out' when 1 then 'in' 
end as inout3, a4.name as name4, a4.type as type4, a4.type_digits as 
type_digits4, a4.type_scale as type_scale4, case a4.inout when 0 then 'out' 
when 1 then 'in' end as inout4, a5.name as name5, a5.type as type5, 
a5.type_digits as type_digits5, a5.type_scale as type_scale5, case a5.inout 
when 0 then 'out' when 1 then 'in' end as inout5, a6.name as name6, a6.type as 
type6, a6.type_digits as type_digits6, a6.type_scale as type_scale6, case 
a6.inout when 0 then 'out' when 1 then 'in' end as inout6, a7.name as name7, 
a7.type as type7, a7.type_digits as type_digits7, a7.type_scale as type_scale7, 
case a7.inout when 0 then 'out' when 1 then 'in' end as inout7, a8.name as 
name8, a8.type as type8, a8.type_digits as type_digits8, a8.type_scale as 
type_scale8, case a8.inout when 0 then 'out' when 1 then 'in' end as inout8, 
a9.name as name9, a9.type as type9, a9.type_digits as type_digits9, 
a9.type_scale as type_scal
 e9, case a9.inout when 0 then 'out' when 1 then 'in' end as inout9, a10.name 
as name10, a10.type as type10, a10.type_digits as type_digits10, a10.type_scale 
as type_scale10, case a10.inout when 0 then 'out' when 1 then 'in' end as 
inout10, a11.name as name11, a11.type as type11, a11.type_digits as 
type_digits11, a11.type_scale as type_scale11, case a11.inout when 0 then 'out' 
when 1 then 'in' end as inout11, a12.name as name12, a12.type as type12, 
a12.type_digits as type_digits12, a12.type_scale as type_scale12, case 
a12.inout when 0 then 'out' when 1 then 'in' end as inout12, a13.name as 
name13, a13.type as type13, a13.type_digits as type_digits13, a13.type_scale as 
type_scale13, case a13.inout when 0 then 'out' when 1 then 'in' end as inout13, 
a14.name as name14, a14.type as type14, a14.type_digits as type_digits14, 
a14.type_scale as type_scale14, case a14.inout when 0 then 'out' when 1 then 
'in' end as inout14, a15.name as name15, a15.type as type15, a15.type_digits as 
type_digit
 s15, a15.type_scale as type_scale15, case a15.inout when 0 then 'out' when 1 
then 'in' end as inout15 from sys.functions f left outer join sys.schemas s on 
f.schema_id = s.id left outer join sys.function_types as ft on f.type = 
ft.function_type_id left outer join sys.function_languages fl on f.language = 
fl.language_id left outer join sys.comments c on c.id = f.id left outer join 
sys.args a0 on a0.func_id = f.id and a0.number = 0 left outer join sys.args a1 
on a1.func_id = f.id and a1.number = 1 left outer join sys.args a2 on 
a2.func_id = f.id and a2.number = 2 left outer join sys.args a3 on a3.func_id = 
f.id and a3.number = 3 left outer join sys.args a4 on a4.func_id = f.id and 
a4.number = 4 left outer join sys.args a5 on a5.func_id = f.id and a5.number = 
5 left outer join sys.args a6 on a6.func_id = f.id and a6.number = 6 left outer 
join sys.args a7 on a7.func_id = f.id and a7.number = 7 left outer join 
sys.args a8 on a8.func_id = f.id and a8.number = 8 left outer join sys.args a9
  on a9.func_id = f.id and a9.number = 9 left outer join sys.args a10 on 
a10.func_id = f.id and a10.number = 10 left outer join sys.args a11 on 
a11.func_id = f.id and a11.number = 11 left outer join sys.args a12 on 
a12.func_id = f.id and a12.number = 12 left outer join sys.args a13 on 
a13.func_id = f.id and a13.number = 13 left outer join sys.args a14 on 
a14.func_id = f.id and a14.number = 14 left outer join sys.args a15 on 
a15.func_id = f.id and a15.number = 15 order by s.name, f.name, query, 
func_type, name0 nulls first, type0 nulls first, type_digits0 nulls first, 
type_scale0 nulls first, inout0 nulls first, name1 nulls first, type1 nulls 
first, type_digits1 nulls first, type_scale1 nulls first, inout1 nulls first, 
name2 nulls first, type2 nulls first, type_digits2 nulls first, type_scale2 
nulls first, inout2 nulls first, name3 nulls first, type3 nulls first, 
type_digits3 nulls first, type_scale3 nulls first, inout3 nulls first, name4 
nulls first, type4 nulls first, type_digits4 n
 ulls first, type_scale4 nulls first, inout4 nulls first, name5 nulls first, 
type5 nulls first, type_digits5 nulls first, type_scale5 nulls first, inout5 
nulls first, name6 nulls first, type6 nulls first, type_digits6 nulls first, 
type_scale6 nulls first, inout6 nulls first, name7 nulls first, type7 nulls 
first, type_digits7 nulls first, type_scale7 nulls first, inout7 nulls first, 
name8 nulls first, type8 nulls first, type_digits8 nulls first, type_scale8 
nulls first, inout8 nulls first, name9 nulls first, type9 nulls first, 
type_digits9 nulls first, type_scale9 nulls first, inout9 nulls first, name10 
nulls first, type10 nulls first, type_digits10 nulls first, type_scale10 nulls 
first, inout10 nulls first, name11 nulls first, type11 nulls first, 
type_digits11 nulls first, type_scale11 nulls first, inout11 nulls first, 
name12 nulls first, type12 nulls first, type_digits12 nulls first, type_scale12 
nulls first, inout12 nulls first, name13 nulls first, type13 nulls first, 
type_digits13
  nulls first, type_scale13 nulls first, inout13 nulls first, name14 nulls 
first, type14 nulls first, type_digits14 nulls first, type_scale14 nulls first, 
inout14 nulls first, name15 nulls first, type15 nulls first, type_digits15 
nulls first, type_scale15 nulls first, inout15 nulls first;
 -- auths
 select 'sys.auths', a1.name as name, a2.name as grantor from sys.auths a1 left 
outer join sys.auths a2 on a1.grantor = a2.id order by a1.name;
 -- db_user_info
@@ -72,8 +70,6 @@ select 'sys.index_types', index_type_nam
 select 'sys.privilege_codes', privilege_code_name from sys.privilege_codes 
order by privilege_code_name;
 -- dependency_types
 select 'sys.dependency_types', dependency_type_id, dependency_type_name from 
sys.dependency_types order by dependency_type_id, dependency_type_name;
--- drop helper function
-drop function pcre_replace(string, string, string, string);
 select 'duplicates in schemas', count(*), id from sys.schemas group by id 
having count(*) > 1;
 select 'duplicates in _tables', count(*), id from sys._tables group by id 
having count(*) > 1;
 select 'duplicates in tables', count(*), id from sys.tables group by id having 
count(*) > 1;
@@ -2225,7 +2221,6 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions",     "sys",  "patindex",     "SYSTEM",       "patindex",     
"pcre", "Internal C",   "Scalar function",      false,  false,  false,  false,  
NULL,   "res_0",        "int",  31,     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",  "pause",        "SYSTEM",       "create 
procedure sys.pause(tag bigint) external name sysmon.pause;",   "sysmon",       
"MAL",  "Procedure",    true,   false,  false,  true,   NULL,   "tag",  
"bigint",       63,     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,   NULL,   NULL,   NULL,   NULL,   NULL    
]
 [ "sys.functions",     "sys",  "pause",        "SYSTEM",       "create 
procedure sys.pause(tag bigint, username string) external name sysmon.pause;",  
"sysmon",       "MAL",  "Procedure",    true,   false,  false,  true,   NULL,   
"tag",  "bigint",       63,     0,      "in",   "username",     "varchar",      
0,      0,      "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL    ]
-[ "sys.functions",     "sys",  "pcre_replace", "",     "create function 
pcre_replace(origin string, pat string, repl string, flags string) returns 
string external name pcre.replace;",        "pcre", "MAL",  "Scalar function",  
    false,  false,  false,  true,   NULL,   "result",       "varchar",      0,  
    0,      "out",  "origin",       "varchar",      0,      0,      "in",   
"pat",  "varchar",      0,      0,      "in",   "repl", "varchar",      0,      
0,      "in",   "flags",        "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    ]
 [ "sys.functions",     "sys",  "percent_rank", "SYSTEM",       "percent_rank", 
"sql",  "Internal C",   "Analytic function",    false,  false,  false,  true,   
NULL,   "res_0",        "double",       53,     0,      "out",  "arg_1",        
"any",  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",  "persist_unlogged",     "SYSTEM",       "create 
function sys.persist_unlogged(sname string, tname string) returns 
table(\"table\" string, \"table_id\" int, \"rowcount\" bigint) external name 
sql.persist_unlogged;",  "sql",  "MAL",  "Function returning a table",   true,  
 false,  false,  true,   NULL,   "table",        "varchar",      0,      0,     
 "out",  "table_id",     "int",  31,     0,      "out",  "rowcount",     
"bigint",       63,     0,      "out",  "sname",        "varchar",      0,      
0,      "in",   "tname",        "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    ]
 [ "sys.functions",     "sys",  "pi",   "SYSTEM",       "pi",   "mmath",        
"Internal C",   "Scalar function",      false,  false,  false,  false,  NULL,   
"res_0",        "double",       53,     0,      "out",  NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL    ]
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
@@ -1,10 +1,8 @@
 
--- helper function
-create function pcre_replace(origin string, pat string, repl string, flags 
string) returns string external name pcre.replace;
 -- schemas
 select 'sys.schemas', s.name, a1.name as authorization, a2.name as owner, 
system, c.remark as comment from sys.schemas s left outer join sys.auths a1 on 
s.authorization = a1.id left outer join sys.auths a2 on s.owner = a2.id left 
outer join sys.comments c on c.id = s.id order by s.name;
 -- _tables
-select 'sys._tables', s.name, t.name, 
replace(replace(pcre_replace(pcre_replace(t.query, E'--.*\n*', '', ''), E'[ 
\t\n]+', ' ', ''), '( ', '('), ' )', ')') as query, tt.table_type_name as type, 
t.system, ca.action_name as commit_action, at.value as access, c.remark as 
comment from sys._tables t left outer join sys.schemas s on t.schema_id = s.id 
left outer join sys.table_types tt on t.type = tt.table_type_id left outer join 
(values (0, 'COMMIT'), (1, 'DELETE'), (2, 'PRESERVE'), (3, 'DROP'), (4, 
'ABORT')) as ca (action_id, action_name) on t.commit_action = ca.action_id left 
outer join (values (0, 'WRITABLE'), (1, 'READONLY'), (2, 'APPENDONLY')) as at 
(id, value) on t.access = at.id left outer join sys.comments c on c.id = t.id 
order by s.name, t.name;
+select 'sys._tables', s.name, t.name, 
replace(replace(sys.regexp_replace(sys.regexp_replace(t.query, E'--.*\n*', '', 
''), E'[ \t\n]+', ' ', ''), '( ', '('), ' )', ')') as query, tt.table_type_name 
as type, t.system, ca.action_name as commit_action, at.value as access, 
c.remark as comment from sys._tables t left outer join sys.schemas s on 
t.schema_id = s.id left outer join sys.table_types tt on t.type = 
tt.table_type_id left outer join (values (0, 'COMMIT'), (1, 'DELETE'), (2, 
'PRESERVE'), (3, 'DROP'), (4, 'ABORT')) as ca (action_id, action_name) on 
t.commit_action = ca.action_id left outer join (values (0, 'WRITABLE'), (1, 
'READONLY'), (2, 'APPENDONLY')) as at (id, value) on t.access = at.id left 
outer join sys.comments c on c.id = t.id order by s.name, t.name;
 -- _columns
 select 'sys._columns', s.name, t.name, c.name, c.type, c.type_digits, 
c.type_scale, c."default", c."null", c.number, c.storage, r.remark as comment 
from sys.schemas s, sys._tables t, sys._columns c left outer join sys.comments 
r on r.id = c.id where s.id = t.schema_id and t.id = c.table_id order by 
s.name, t.name, c.number;
 -- partitioned tables (these three should be empty)
@@ -12,9 +10,9 @@ select 'sys.table_partitions', t.name, c
 select 'sys.range_partitions', t.name, p.expression, r.minimum, r.maximum, 
r.with_nulls from sys.range_partitions r left outer join sys._tables t on t.id 
= r.table_id left outer join sys.table_partitions p on r.partition_id = p.id;
 select 'sys.value_partitions', t.name, p.expression, v.value from 
sys.value_partitions v left outer join sys._tables t on t.id = v.table_id left 
outer join sys.table_partitions p on v.partition_id = p.id;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with funcs as (select name, pcre_replace(func, E'--.*\n*', '', '') as func, 
schema_id from sys.functions), x (sname, name, modfunc) as (select s.name, 
f.name, replace(pcre_replace(f.func, '.*external name (.*);.*', '$1', 'ims'), 
'"', '') from funcs f left outer join sys.schemas s on f.schema_id = s.id where 
f.func ilike '% external name %') select 'dangling external functions', * from 
x where x.modfunc not in (select m.module || '.' || m."function" from 
sys.malfunctions() m);
+with funcs as (select name, sys.regexp_replace(func, E'--.*\n*', '', '') as 
func, schema_id from sys.functions), x (sname, name, modfunc) as (select 
s.name, f.name, replace(sys.regexp_replace(f.func, '.*external name (.*);.*', 
'$1', 'ims'), '"', '') from funcs f left outer join sys.schemas s on 
f.schema_id = s.id where f.func ilike '% external name %') select 'dangling 
external functions', * from x where x.modfunc not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
 -- args
-select 'sys.functions', s.name, f.name, case f.system when true then 'SYSTEM' 
else '' end as system, 
replace(replace(replace(pcre_replace(pcre_replace(pcre_replace(f.func, 
E'--.*\n', '', ''), E'[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', 
')'), 'create system ', 'create ') as query, f.mod, fl.language_name, 
ft.function_type_name as func_type, f.side_effect, f.varres, f.vararg, 
f.semantics, c.remark as comment, a0.name as name0, a0.type as type0, 
a0.type_digits as type_digits0, a0.type_scale as type_scale0, case a0.inout 
when 0 then 'out' when 1 then 'in' end as inout0, a1.name as name1, a1.type as 
type1, a1.type_digits as type_digits1, a1.type_scale as type_scale1, case 
a1.inout when 0 then 'out' when 1 then 'in' end as inout1, a2.name as name2, 
a2.type as type2, a2.type_digits as type_digits2, a2.type_scale as type_scale2, 
case a2.inout when 0 then 'out' when 1 then 'in' end as inout2, a3.name as 
name3, a3.type as type3, a3.type_digits as type_digits3, a3.type_scale as ty
 pe_scale3, case a3.inout when 0 then 'out' when 1 then 'in' end as inout3, 
a4.name as name4, a4.type as type4, a4.type_digits as type_digits4, 
a4.type_scale as type_scale4, case a4.inout when 0 then 'out' when 1 then 'in' 
end as inout4, a5.name as name5, a5.type as type5, a5.type_digits as 
type_digits5, a5.type_scale as type_scale5, case a5.inout when 0 then 'out' 
when 1 then 'in' end as inout5, a6.name as name6, a6.type as type6, 
a6.type_digits as type_digits6, a6.type_scale as type_scale6, case a6.inout 
when 0 then 'out' when 1 then 'in' end as inout6, a7.name as name7, a7.type as 
type7, a7.type_digits as type_digits7, a7.type_scale as type_scale7, case 
a7.inout when 0 then 'out' when 1 then 'in' end as inout7, a8.name as name8, 
a8.type as type8, a8.type_digits as type_digits8, a8.type_scale as type_scale8, 
case a8.inout when 0 then 'out' when 1 then 'in' end as inout8, a9.name as 
name9, a9.type as type9, a9.type_digits as type_digits9, a9.type_scale as 
type_scale9, case a9.inout 
 when 0 then 'out' when 1 then 'in' end as inout9, a10.name as name10, a10.type 
as type10, a10.type_digits as type_digits10, a10.type_scale as type_scale10, 
case a10.inout when 0 then 'out' when 1 then 'in' end as inout10, a11.name as 
name11, a11.type as type11, a11.type_digits as type_digits11, a11.type_scale as 
type_scale11, case a11.inout when 0 then 'out' when 1 then 'in' end as inout11, 
a12.name as name12, a12.type as type12, a12.type_digits as type_digits12, 
a12.type_scale as type_scale12, case a12.inout when 0 then 'out' when 1 then 
'in' end as inout12, a13.name as name13, a13.type as type13, a13.type_digits as 
type_digits13, a13.type_scale as type_scale13, case a13.inout when 0 then 'out' 
when 1 then 'in' end as inout13, a14.name as name14, a14.type as type14, 
a14.type_digits as type_digits14, a14.type_scale as type_scale14, case 
a14.inout when 0 then 'out' when 1 then 'in' end as inout14, a15.name as 
name15, a15.type as type15, a15.type_digits as type_digits15, a15.type_scal
 e as type_scale15, case a15.inout when 0 then 'out' when 1 then 'in' end as 
inout15 from sys.functions f left outer join sys.schemas s on f.schema_id = 
s.id left outer join sys.function_types as ft on f.type = ft.function_type_id 
left outer join sys.function_languages fl on f.language = fl.language_id left 
outer join sys.comments c on c.id = f.id left outer join sys.args a0 on 
a0.func_id = f.id and a0.number = 0 left outer join sys.args a1 on a1.func_id = 
f.id and a1.number = 1 left outer join sys.args a2 on a2.func_id = f.id and 
a2.number = 2 left outer join sys.args a3 on a3.func_id = f.id and a3.number = 
3 left outer join sys.args a4 on a4.func_id = f.id and a4.number = 4 left outer 
join sys.args a5 on a5.func_id = f.id and a5.number = 5 left outer join 
sys.args a6 on a6.func_id = f.id and a6.number = 6 left outer join sys.args a7 
on a7.func_id = f.id and a7.number = 7 left outer join sys.args a8 on 
a8.func_id = f.id and a8.number = 8 left outer join sys.args a9 on a9.func_id = 
f
 .id and a9.number = 9 left outer join sys.args a10 on a10.func_id = f.id and 
a10.number = 10 left outer join sys.args a11 on a11.func_id = f.id and 
a11.number = 11 left outer join sys.args a12 on a12.func_id = f.id and 
a12.number = 12 left outer join sys.args a13 on a13.func_id = f.id and 
a13.number = 13 left outer join sys.args a14 on a14.func_id = f.id and 
a14.number = 14 left outer join sys.args a15 on a15.func_id = f.id and 
a15.number = 15 order by s.name, f.name, query, func_type, name0 nulls first, 
type0 nulls first, type_digits0 nulls first, type_scale0 nulls first, inout0 
nulls first, name1 nulls first, type1 nulls first, type_digits1 nulls first, 
type_scale1 nulls first, inout1 nulls first, name2 nulls first, type2 nulls 
first, type_digits2 nulls first, type_scale2 nulls first, inout2 nulls first, 
name3 nulls first, type3 nulls first, type_digits3 nulls first, type_scale3 
nulls first, inout3 nulls first, name4 nulls first, type4 nulls first, 
type_digits4 nulls first, type_s
 cale4 nulls first, inout4 nulls first, name5 nulls first, type5 nulls first, 
type_digits5 nulls first, type_scale5 nulls first, inout5 nulls first, name6 
nulls first, type6 nulls first, type_digits6 nulls first, type_scale6 nulls 
first, inout6 nulls first, name7 nulls first, type7 nulls first, type_digits7 
nulls first, type_scale7 nulls first, inout7 nulls first, name8 nulls first, 
type8 nulls first, type_digits8 nulls first, type_scale8 nulls first, inout8 
nulls first, name9 nulls first, type9 nulls first, type_digits9 nulls first, 
type_scale9 nulls first, inout9 nulls first, name10 nulls first, type10 nulls 
first, type_digits10 nulls first, type_scale10 nulls first, inout10 nulls 
first, name11 nulls first, type11 nulls first, type_digits11 nulls first, 
type_scale11 nulls first, inout11 nulls first, name12 nulls first, type12 nulls 
first, type_digits12 nulls first, type_scale12 nulls first, inout12 nulls 
first, name13 nulls first, type13 nulls first, type_digits13 nulls first, type
 _scale13 nulls first, inout13 nulls first, name14 nulls first, type14 nulls 
first, type_digits14 nulls first, type_scale14 nulls first, inout14 nulls 
first, name15 nulls first, type15 nulls first, type_digits15 nulls first, 
type_scale15 nulls first, inout15 nulls first;
+select 'sys.functions', s.name, f.name, case f.system when true then 'SYSTEM' 
else '' end as system, 
replace(replace(replace(sys.regexp_replace(sys.regexp_replace(sys.regexp_replace(f.func,
 E'--.*\n', '', ''), E'[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', 
')'), 'create system ', 'create ') as query, f.mod, fl.language_name, 
ft.function_type_name as func_type, f.side_effect, f.varres, f.vararg, 
f.semantics, c.remark as comment, a0.name as name0, a0.type as type0, 
a0.type_digits as type_digits0, a0.type_scale as type_scale0, case a0.inout 
when 0 then 'out' when 1 then 'in' end as inout0, a1.name as name1, a1.type as 
type1, a1.type_digits as type_digits1, a1.type_scale as type_scale1, case 
a1.inout when 0 then 'out' when 1 then 'in' end as inout1, a2.name as name2, 
a2.type as type2, a2.type_digits as type_digits2, a2.type_scale as type_scale2, 
case a2.inout when 0 then 'out' when 1 then 'in' end as inout2, a3.name as 
name3, a3.type as type3, a3.type_digits as type_digits3, a
 3.type_scale as type_scale3, case a3.inout when 0 then 'out' when 1 then 'in' 
end as inout3, a4.name as name4, a4.type as type4, a4.type_digits as 
type_digits4, a4.type_scale as type_scale4, case a4.inout when 0 then 'out' 
when 1 then 'in' end as inout4, a5.name as name5, a5.type as type5, 
a5.type_digits as type_digits5, a5.type_scale as type_scale5, case a5.inout 
when 0 then 'out' when 1 then 'in' end as inout5, a6.name as name6, a6.type as 
type6, a6.type_digits as type_digits6, a6.type_scale as type_scale6, case 
a6.inout when 0 then 'out' when 1 then 'in' end as inout6, a7.name as name7, 
a7.type as type7, a7.type_digits as type_digits7, a7.type_scale as type_scale7, 
case a7.inout when 0 then 'out' when 1 then 'in' end as inout7, a8.name as 
name8, a8.type as type8, a8.type_digits as type_digits8, a8.type_scale as 
type_scale8, case a8.inout when 0 then 'out' when 1 then 'in' end as inout8, 
a9.name as name9, a9.type as type9, a9.type_digits as type_digits9, 
a9.type_scale as type_scal
 e9, case a9.inout when 0 then 'out' when 1 then 'in' end as inout9, a10.name 
as name10, a10.type as type10, a10.type_digits as type_digits10, a10.type_scale 
as type_scale10, case a10.inout when 0 then 'out' when 1 then 'in' end as 
inout10, a11.name as name11, a11.type as type11, a11.type_digits as 
type_digits11, a11.type_scale as type_scale11, case a11.inout when 0 then 'out' 
when 1 then 'in' end as inout11, a12.name as name12, a12.type as type12, 
a12.type_digits as type_digits12, a12.type_scale as type_scale12, case 
a12.inout when 0 then 'out' when 1 then 'in' end as inout12, a13.name as 
name13, a13.type as type13, a13.type_digits as type_digits13, a13.type_scale as 
type_scale13, case a13.inout when 0 then 'out' when 1 then 'in' end as inout13, 
a14.name as name14, a14.type as type14, a14.type_digits as type_digits14, 
a14.type_scale as type_scale14, case a14.inout when 0 then 'out' when 1 then 
'in' end as inout14, a15.name as name15, a15.type as type15, a15.type_digits as 
type_digit
 s15, a15.type_scale as type_scale15, case a15.inout when 0 then 'out' when 1 
then 'in' end as inout15 from sys.functions f left outer join sys.schemas s on 
f.schema_id = s.id left outer join sys.function_types as ft on f.type = 
ft.function_type_id left outer join sys.function_languages fl on f.language = 
fl.language_id left outer join sys.comments c on c.id = f.id left outer join 
sys.args a0 on a0.func_id = f.id and a0.number = 0 left outer join sys.args a1 
on a1.func_id = f.id and a1.number = 1 left outer join sys.args a2 on 
a2.func_id = f.id and a2.number = 2 left outer join sys.args a3 on a3.func_id = 
f.id and a3.number = 3 left outer join sys.args a4 on a4.func_id = f.id and 
a4.number = 4 left outer join sys.args a5 on a5.func_id = f.id and a5.number = 
5 left outer join sys.args a6 on a6.func_id = f.id and a6.number = 6 left outer 
join sys.args a7 on a7.func_id = f.id and a7.number = 7 left outer join 
sys.args a8 on a8.func_id = f.id and a8.number = 8 left outer join sys.args a9
  on a9.func_id = f.id and a9.number = 9 left outer join sys.args a10 on 
a10.func_id = f.id and a10.number = 10 left outer join sys.args a11 on 
a11.func_id = f.id and a11.number = 11 left outer join sys.args a12 on 
a12.func_id = f.id and a12.number = 12 left outer join sys.args a13 on 
a13.func_id = f.id and a13.number = 13 left outer join sys.args a14 on 
a14.func_id = f.id and a14.number = 14 left outer join sys.args a15 on 
a15.func_id = f.id and a15.number = 15 order by s.name, f.name, query, 
func_type, name0 nulls first, type0 nulls first, type_digits0 nulls first, 
type_scale0 nulls first, inout0 nulls first, name1 nulls first, type1 nulls 
first, type_digits1 nulls first, type_scale1 nulls first, inout1 nulls first, 
name2 nulls first, type2 nulls first, type_digits2 nulls first, type_scale2 
nulls first, inout2 nulls first, name3 nulls first, type3 nulls first, 
type_digits3 nulls first, type_scale3 nulls first, inout3 nulls first, name4 
nulls first, type4 nulls first, type_digits4 n
 ulls first, type_scale4 nulls first, inout4 nulls first, name5 nulls first, 
type5 nulls first, type_digits5 nulls first, type_scale5 nulls first, inout5 
nulls first, name6 nulls first, type6 nulls first, type_digits6 nulls first, 
type_scale6 nulls first, inout6 nulls first, name7 nulls first, type7 nulls 
first, type_digits7 nulls first, type_scale7 nulls first, inout7 nulls first, 
name8 nulls first, type8 nulls first, type_digits8 nulls first, type_scale8 
nulls first, inout8 nulls first, name9 nulls first, type9 nulls first, 
type_digits9 nulls first, type_scale9 nulls first, inout9 nulls first, name10 
nulls first, type10 nulls first, type_digits10 nulls first, type_scale10 nulls 
first, inout10 nulls first, name11 nulls first, type11 nulls first, 
type_digits11 nulls first, type_scale11 nulls first, inout11 nulls first, 
name12 nulls first, type12 nulls first, type_digits12 nulls first, type_scale12 
nulls first, inout12 nulls first, name13 nulls first, type13 nulls first, 
type_digits13
  nulls first, type_scale13 nulls first, inout13 nulls first, name14 nulls 
first, type14 nulls first, type_digits14 nulls first, type_scale14 nulls first, 
inout14 nulls first, name15 nulls first, type15 nulls first, type_digits15 
nulls first, type_scale15 nulls first, inout15 nulls first;
 -- auths
 select 'sys.auths', a1.name as name, a2.name as grantor from sys.auths a1 left 
outer join sys.auths a2 on a1.grantor = a2.id order by a1.name;
 -- db_user_info
@@ -72,8 +70,6 @@ select 'sys.index_types', index_type_nam
 select 'sys.privilege_codes', privilege_code_name from sys.privilege_codes 
order by privilege_code_name;
 -- dependency_types
 select 'sys.dependency_types', dependency_type_id, dependency_type_name from 
sys.dependency_types order by dependency_type_id, dependency_type_name;
--- drop helper function
-drop function pcre_replace(string, string, string, string);
 select 'duplicates in schemas', count(*), id from sys.schemas group by id 
having count(*) > 1;
 select 'duplicates in _tables', count(*), id from sys._tables group by id 
having count(*) > 1;
 select 'duplicates in tables', count(*), id from sys.tables group by id having 
count(*) > 1;
@@ -2223,7 +2219,6 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions",     "sys",  "patindex",     "SYSTEM",       "patindex",     
"pcre", "Internal C",   "Scalar function",      false,  false,  false,  false,  
NULL,   "res_0",        "int",  31,     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",  "pause",        "SYSTEM",       "create 
procedure sys.pause(tag bigint) external name sysmon.pause;",   "sysmon",       
"MAL",  "Procedure",    true,   false,  false,  true,   NULL,   "tag",  
"bigint",       63,     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,   NULL,   NULL,   NULL,   NULL,   NULL    
]
 [ "sys.functions",     "sys",  "pause",        "SYSTEM",       "create 
procedure sys.pause(tag bigint, username string) external name sysmon.pause;",  
"sysmon",       "MAL",  "Procedure",    true,   false,  false,  true,   NULL,   
"tag",  "bigint",       63,     0,      "in",   "username",     "varchar",      
0,      0,      "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL    ]
-[ "sys.functions",     "sys",  "pcre_replace", "",     "create function 
pcre_replace(origin string, pat string, repl string, flags string) returns 
string external name pcre.replace;",        "pcre", "MAL",  "Scalar function",  
    false,  false,  false,  true,   NULL,   "result",       "varchar",      0,  
    0,      "out",  "origin",       "varchar",      0,      0,      "in",   
"pat",  "varchar",      0,      0,      "in",   "repl", "varchar",      0,      
0,      "in",   "flags",        "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    ]
 [ "sys.functions",     "sys",  "percent_rank", "SYSTEM",       "percent_rank", 
"sql",  "Internal C",   "Analytic function",    false,  false,  false,  true,   
NULL,   "res_0",        "double",       53,     0,      "out",  "arg_1",        
"any",  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",  "persist_unlogged",     "SYSTEM",       "create 
function sys.persist_unlogged(sname string, tname string) returns 
table(\"table\" string, \"table_id\" int, \"rowcount\" bigint) external name 
sql.persist_unlogged;",  "sql",  "MAL",  "Function returning a table",   true,  
 false,  false,  true,   NULL,   "table",        "varchar",      0,      0,     
 "out",  "table_id",     "int",  31,     0,      "out",  "rowcount",     
"bigint",       63,     0,      "out",  "sname",        "varchar",      0,      
0,      "in",   "tname",        "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    ]
 [ "sys.functions",     "sys",  "pi",   "SYSTEM",       "pi",   "mmath",        
"Internal C",   "Scalar function",      false,  false,  false,  false,  NULL,   
"res_0",        "double",       53,     0,      "out",  NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL    ]
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
@@ -1,10 +1,8 @@
 
--- helper function
-create function pcre_replace(origin string, pat string, repl string, flags 
string) returns string external name pcre.replace;
 -- schemas
 select 'sys.schemas', s.name, a1.name as authorization, a2.name as owner, 
system, c.remark as comment from sys.schemas s left outer join sys.auths a1 on 
s.authorization = a1.id left outer join sys.auths a2 on s.owner = a2.id left 
outer join sys.comments c on c.id = s.id order by s.name;
 -- _tables
-select 'sys._tables', s.name, t.name, 
replace(replace(pcre_replace(pcre_replace(t.query, E'--.*\n*', '', ''), E'[ 
\t\n]+', ' ', ''), '( ', '('), ' )', ')') as query, tt.table_type_name as type, 
t.system, ca.action_name as commit_action, at.value as access, c.remark as 
comment from sys._tables t left outer join sys.schemas s on t.schema_id = s.id 
left outer join sys.table_types tt on t.type = tt.table_type_id left outer join 
(values (0, 'COMMIT'), (1, 'DELETE'), (2, 'PRESERVE'), (3, 'DROP'), (4, 
'ABORT')) as ca (action_id, action_name) on t.commit_action = ca.action_id left 
outer join (values (0, 'WRITABLE'), (1, 'READONLY'), (2, 'APPENDONLY')) as at 
(id, value) on t.access = at.id left outer join sys.comments c on c.id = t.id 
order by s.name, t.name;
+select 'sys._tables', s.name, t.name, 
replace(replace(sys.regexp_replace(sys.regexp_replace(t.query, E'--.*\n*', '', 
''), E'[ \t\n]+', ' ', ''), '( ', '('), ' )', ')') as query, tt.table_type_name 
as type, t.system, ca.action_name as commit_action, at.value as access, 
c.remark as comment from sys._tables t left outer join sys.schemas s on 
t.schema_id = s.id left outer join sys.table_types tt on t.type = 
tt.table_type_id left outer join (values (0, 'COMMIT'), (1, 'DELETE'), (2, 
'PRESERVE'), (3, 'DROP'), (4, 'ABORT')) as ca (action_id, action_name) on 
t.commit_action = ca.action_id left outer join (values (0, 'WRITABLE'), (1, 
'READONLY'), (2, 'APPENDONLY')) as at (id, value) on t.access = at.id left 
outer join sys.comments c on c.id = t.id order by s.name, t.name;
 -- _columns
 select 'sys._columns', s.name, t.name, c.name, c.type, c.type_digits, 
c.type_scale, c."default", c."null", c.number, c.storage, r.remark as comment 
from sys.schemas s, sys._tables t, sys._columns c left outer join sys.comments 
r on r.id = c.id where s.id = t.schema_id and t.id = c.table_id order by 
s.name, t.name, c.number;
 -- partitioned tables (these three should be empty)
@@ -12,9 +10,9 @@ select 'sys.table_partitions', t.name, c
 select 'sys.range_partitions', t.name, p.expression, r.minimum, r.maximum, 
r.with_nulls from sys.range_partitions r left outer join sys._tables t on t.id 
= r.table_id left outer join sys.table_partitions p on r.partition_id = p.id;
 select 'sys.value_partitions', t.name, p.expression, v.value from 
sys.value_partitions v left outer join sys._tables t on t.id = v.table_id left 
outer join sys.table_partitions p on v.partition_id = p.id;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with funcs as (select name, pcre_replace(func, E'--.*\n*', '', '') as func, 
schema_id from sys.functions), x (sname, name, modfunc) as (select s.name, 
f.name, replace(pcre_replace(f.func, '.*external name (.*);.*', '$1', 'ims'), 
'"', '') from funcs f left outer join sys.schemas s on f.schema_id = s.id where 
f.func ilike '% external name %') select 'dangling external functions', * from 
x where x.modfunc not in (select m.module || '.' || m."function" from 
sys.malfunctions() m);
+with funcs as (select name, sys.regexp_replace(func, E'--.*\n*', '', '') as 
func, schema_id from sys.functions), x (sname, name, modfunc) as (select 
s.name, f.name, replace(sys.regexp_replace(f.func, '.*external name (.*);.*', 
'$1', 'ims'), '"', '') from funcs f left outer join sys.schemas s on 
f.schema_id = s.id where f.func ilike '% external name %') select 'dangling 
external functions', * from x where x.modfunc not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
 -- args
-select 'sys.functions', s.name, f.name, case f.system when true then 'SYSTEM' 
else '' end as system, 
replace(replace(replace(pcre_replace(pcre_replace(pcre_replace(f.func, 
E'--.*\n', '', ''), E'[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', 
')'), 'create system ', 'create ') as query, f.mod, fl.language_name, 
ft.function_type_name as func_type, f.side_effect, f.varres, f.vararg, 
f.semantics, c.remark as comment, a0.name as name0, a0.type as type0, 
a0.type_digits as type_digits0, a0.type_scale as type_scale0, case a0.inout 
when 0 then 'out' when 1 then 'in' end as inout0, a1.name as name1, a1.type as 
type1, a1.type_digits as type_digits1, a1.type_scale as type_scale1, case 
a1.inout when 0 then 'out' when 1 then 'in' end as inout1, a2.name as name2, 
a2.type as type2, a2.type_digits as type_digits2, a2.type_scale as type_scale2, 
case a2.inout when 0 then 'out' when 1 then 'in' end as inout2, a3.name as 
name3, a3.type as type3, a3.type_digits as type_digits3, a3.type_scale as ty
 pe_scale3, case a3.inout when 0 then 'out' when 1 then 'in' end as inout3, 
a4.name as name4, a4.type as type4, a4.type_digits as type_digits4, 
a4.type_scale as type_scale4, case a4.inout when 0 then 'out' when 1 then 'in' 
end as inout4, a5.name as name5, a5.type as type5, a5.type_digits as 
type_digits5, a5.type_scale as type_scale5, case a5.inout when 0 then 'out' 
when 1 then 'in' end as inout5, a6.name as name6, a6.type as type6, 
a6.type_digits as type_digits6, a6.type_scale as type_scale6, case a6.inout 
when 0 then 'out' when 1 then 'in' end as inout6, a7.name as name7, a7.type as 
type7, a7.type_digits as type_digits7, a7.type_scale as type_scale7, case 
a7.inout when 0 then 'out' when 1 then 'in' end as inout7, a8.name as name8, 
a8.type as type8, a8.type_digits as type_digits8, a8.type_scale as type_scale8, 
case a8.inout when 0 then 'out' when 1 then 'in' end as inout8, a9.name as 
name9, a9.type as type9, a9.type_digits as type_digits9, a9.type_scale as 
type_scale9, case a9.inout 
 when 0 then 'out' when 1 then 'in' end as inout9, a10.name as name10, a10.type 
as type10, a10.type_digits as type_digits10, a10.type_scale as type_scale10, 
case a10.inout when 0 then 'out' when 1 then 'in' end as inout10, a11.name as 
name11, a11.type as type11, a11.type_digits as type_digits11, a11.type_scale as 
type_scale11, case a11.inout when 0 then 'out' when 1 then 'in' end as inout11, 
a12.name as name12, a12.type as type12, a12.type_digits as type_digits12, 
a12.type_scale as type_scale12, case a12.inout when 0 then 'out' when 1 then 
'in' end as inout12, a13.name as name13, a13.type as type13, a13.type_digits as 
type_digits13, a13.type_scale as type_scale13, case a13.inout when 0 then 'out' 
when 1 then 'in' end as inout13, a14.name as name14, a14.type as type14, 
a14.type_digits as type_digits14, a14.type_scale as type_scale14, case 
a14.inout when 0 then 'out' when 1 then 'in' end as inout14, a15.name as 
name15, a15.type as type15, a15.type_digits as type_digits15, a15.type_scal
 e as type_scale15, case a15.inout when 0 then 'out' when 1 then 'in' end as 
inout15 from sys.functions f left outer join sys.schemas s on f.schema_id = 
s.id left outer join sys.function_types as ft on f.type = ft.function_type_id 
left outer join sys.function_languages fl on f.language = fl.language_id left 
outer join sys.comments c on c.id = f.id left outer join sys.args a0 on 
a0.func_id = f.id and a0.number = 0 left outer join sys.args a1 on a1.func_id = 
f.id and a1.number = 1 left outer join sys.args a2 on a2.func_id = f.id and 
a2.number = 2 left outer join sys.args a3 on a3.func_id = f.id and a3.number = 
3 left outer join sys.args a4 on a4.func_id = f.id and a4.number = 4 left outer 
join sys.args a5 on a5.func_id = f.id and a5.number = 5 left outer join 
sys.args a6 on a6.func_id = f.id and a6.number = 6 left outer join sys.args a7 
on a7.func_id = f.id and a7.number = 7 left outer join sys.args a8 on 
a8.func_id = f.id and a8.number = 8 left outer join sys.args a9 on a9.func_id = 
f
 .id and a9.number = 9 left outer join sys.args a10 on a10.func_id = f.id and 
a10.number = 10 left outer join sys.args a11 on a11.func_id = f.id and 
a11.number = 11 left outer join sys.args a12 on a12.func_id = f.id and 
a12.number = 12 left outer join sys.args a13 on a13.func_id = f.id and 
a13.number = 13 left outer join sys.args a14 on a14.func_id = f.id and 
a14.number = 14 left outer join sys.args a15 on a15.func_id = f.id and 
a15.number = 15 order by s.name, f.name, query, func_type, name0 nulls first, 
type0 nulls first, type_digits0 nulls first, type_scale0 nulls first, inout0 
nulls first, name1 nulls first, type1 nulls first, type_digits1 nulls first, 
type_scale1 nulls first, inout1 nulls first, name2 nulls first, type2 nulls 
first, type_digits2 nulls first, type_scale2 nulls first, inout2 nulls first, 
name3 nulls first, type3 nulls first, type_digits3 nulls first, type_scale3 
nulls first, inout3 nulls first, name4 nulls first, type4 nulls first, 
type_digits4 nulls first, type_s
 cale4 nulls first, inout4 nulls first, name5 nulls first, type5 nulls first, 
type_digits5 nulls first, type_scale5 nulls first, inout5 nulls first, name6 
nulls first, type6 nulls first, type_digits6 nulls first, type_scale6 nulls 
first, inout6 nulls first, name7 nulls first, type7 nulls first, type_digits7 
nulls first, type_scale7 nulls first, inout7 nulls first, name8 nulls first, 
type8 nulls first, type_digits8 nulls first, type_scale8 nulls first, inout8 
nulls first, name9 nulls first, type9 nulls first, type_digits9 nulls first, 
type_scale9 nulls first, inout9 nulls first, name10 nulls first, type10 nulls 
first, type_digits10 nulls first, type_scale10 nulls first, inout10 nulls 
first, name11 nulls first, type11 nulls first, type_digits11 nulls first, 
type_scale11 nulls first, inout11 nulls first, name12 nulls first, type12 nulls 
first, type_digits12 nulls first, type_scale12 nulls first, inout12 nulls 
first, name13 nulls first, type13 nulls first, type_digits13 nulls first, type
 _scale13 nulls first, inout13 nulls first, name14 nulls first, type14 nulls 
first, type_digits14 nulls first, type_scale14 nulls first, inout14 nulls 
first, name15 nulls first, type15 nulls first, type_digits15 nulls first, 
type_scale15 nulls first, inout15 nulls first;
+select 'sys.functions', s.name, f.name, case f.system when true then 'SYSTEM' 
else '' end as system, 
replace(replace(replace(sys.regexp_replace(sys.regexp_replace(sys.regexp_replace(f.func,
 E'--.*\n', '', ''), E'[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', 
')'), 'create system ', 'create ') as query, f.mod, fl.language_name, 
ft.function_type_name as func_type, f.side_effect, f.varres, f.vararg, 
f.semantics, c.remark as comment, a0.name as name0, a0.type as type0, 
a0.type_digits as type_digits0, a0.type_scale as type_scale0, case a0.inout 
when 0 then 'out' when 1 then 'in' end as inout0, a1.name as name1, a1.type as 
type1, a1.type_digits as type_digits1, a1.type_scale as type_scale1, case 
a1.inout when 0 then 'out' when 1 then 'in' end as inout1, a2.name as name2, 
a2.type as type2, a2.type_digits as type_digits2, a2.type_scale as type_scale2, 
case a2.inout when 0 then 'out' when 1 then 'in' end as inout2, a3.name as 
name3, a3.type as type3, a3.type_digits as type_digits3, a
 3.type_scale as type_scale3, case a3.inout when 0 then 'out' when 1 then 'in' 
end as inout3, a4.name as name4, a4.type as type4, a4.type_digits as 
type_digits4, a4.type_scale as type_scale4, case a4.inout when 0 then 'out' 
when 1 then 'in' end as inout4, a5.name as name5, a5.type as type5, 
a5.type_digits as type_digits5, a5.type_scale as type_scale5, case a5.inout 
when 0 then 'out' when 1 then 'in' end as inout5, a6.name as name6, a6.type as 
type6, a6.type_digits as type_digits6, a6.type_scale as type_scale6, case 
a6.inout when 0 then 'out' when 1 then 'in' end as inout6, a7.name as name7, 
a7.type as type7, a7.type_digits as type_digits7, a7.type_scale as type_scale7, 
case a7.inout when 0 then 'out' when 1 then 'in' end as inout7, a8.name as 
name8, a8.type as type8, a8.type_digits as type_digits8, a8.type_scale as 
type_scale8, case a8.inout when 0 then 'out' when 1 then 'in' end as inout8, 
a9.name as name9, a9.type as type9, a9.type_digits as type_digits9, 
a9.type_scale as type_scal
 e9, case a9.inout when 0 then 'out' when 1 then 'in' end as inout9, a10.name 
as name10, a10.type as type10, a10.type_digits as type_digits10, a10.type_scale 
as type_scale10, case a10.inout when 0 then 'out' when 1 then 'in' end as 
inout10, a11.name as name11, a11.type as type11, a11.type_digits as 
type_digits11, a11.type_scale as type_scale11, case a11.inout when 0 then 'out' 
when 1 then 'in' end as inout11, a12.name as name12, a12.type as type12, 
a12.type_digits as type_digits12, a12.type_scale as type_scale12, case 
a12.inout when 0 then 'out' when 1 then 'in' end as inout12, a13.name as 
name13, a13.type as type13, a13.type_digits as type_digits13, a13.type_scale as 
type_scale13, case a13.inout when 0 then 'out' when 1 then 'in' end as inout13, 
a14.name as name14, a14.type as type14, a14.type_digits as type_digits14, 
a14.type_scale as type_scale14, case a14.inout when 0 then 'out' when 1 then 
'in' end as inout14, a15.name as name15, a15.type as type15, a15.type_digits as 
type_digit
 s15, a15.type_scale as type_scale15, case a15.inout when 0 then 'out' when 1 
then 'in' end as inout15 from sys.functions f left outer join sys.schemas s on 
f.schema_id = s.id left outer join sys.function_types as ft on f.type = 
ft.function_type_id left outer join sys.function_languages fl on f.language = 
fl.language_id left outer join sys.comments c on c.id = f.id left outer join 
sys.args a0 on a0.func_id = f.id and a0.number = 0 left outer join sys.args a1 
on a1.func_id = f.id and a1.number = 1 left outer join sys.args a2 on 
a2.func_id = f.id and a2.number = 2 left outer join sys.args a3 on a3.func_id = 
f.id and a3.number = 3 left outer join sys.args a4 on a4.func_id = f.id and 
a4.number = 4 left outer join sys.args a5 on a5.func_id = f.id and a5.number = 
5 left outer join sys.args a6 on a6.func_id = f.id and a6.number = 6 left outer 
join sys.args a7 on a7.func_id = f.id and a7.number = 7 left outer join 
sys.args a8 on a8.func_id = f.id and a8.number = 8 left outer join sys.args a9
  on a9.func_id = f.id and a9.number = 9 left outer join sys.args a10 on 
a10.func_id = f.id and a10.number = 10 left outer join sys.args a11 on 
a11.func_id = f.id and a11.number = 11 left outer join sys.args a12 on 
a12.func_id = f.id and a12.number = 12 left outer join sys.args a13 on 
a13.func_id = f.id and a13.number = 13 left outer join sys.args a14 on 
a14.func_id = f.id and a14.number = 14 left outer join sys.args a15 on 
a15.func_id = f.id and a15.number = 15 order by s.name, f.name, query, 
func_type, name0 nulls first, type0 nulls first, type_digits0 nulls first, 
type_scale0 nulls first, inout0 nulls first, name1 nulls first, type1 nulls 
first, type_digits1 nulls first, type_scale1 nulls first, inout1 nulls first, 
name2 nulls first, type2 nulls first, type_digits2 nulls first, type_scale2 
nulls first, inout2 nulls first, name3 nulls first, type3 nulls first, 
type_digits3 nulls first, type_scale3 nulls first, inout3 nulls first, name4 
nulls first, type4 nulls first, type_digits4 n
 ulls first, type_scale4 nulls first, inout4 nulls first, name5 nulls first, 
type5 nulls first, type_digits5 nulls first, type_scale5 nulls first, inout5 
nulls first, name6 nulls first, type6 nulls first, type_digits6 nulls first, 
type_scale6 nulls first, inout6 nulls first, name7 nulls first, type7 nulls 
first, type_digits7 nulls first, type_scale7 nulls first, inout7 nulls first, 
name8 nulls first, type8 nulls first, type_digits8 nulls first, type_scale8 
nulls first, inout8 nulls first, name9 nulls first, type9 nulls first, 
type_digits9 nulls first, type_scale9 nulls first, inout9 nulls first, name10 
nulls first, type10 nulls first, type_digits10 nulls first, type_scale10 nulls 
first, inout10 nulls first, name11 nulls first, type11 nulls first, 
type_digits11 nulls first, type_scale11 nulls first, inout11 nulls first, 
name12 nulls first, type12 nulls first, type_digits12 nulls first, type_scale12 
nulls first, inout12 nulls first, name13 nulls first, type13 nulls first, 
type_digits13
  nulls first, type_scale13 nulls first, inout13 nulls first, name14 nulls 
first, type14 nulls first, type_digits14 nulls first, type_scale14 nulls first, 
inout14 nulls first, name15 nulls first, type15 nulls first, type_digits15 
nulls first, type_scale15 nulls first, inout15 nulls first;
 -- auths
 select 'sys.auths', a1.name as name, a2.name as grantor from sys.auths a1 left 
outer join sys.auths a2 on a1.grantor = a2.id order by a1.name;
 -- db_user_info
@@ -72,8 +70,6 @@ select 'sys.index_types', index_type_nam
 select 'sys.privilege_codes', privilege_code_name from sys.privilege_codes 
order by privilege_code_name;
 -- dependency_types
 select 'sys.dependency_types', dependency_type_id, dependency_type_name from 
sys.dependency_types order by dependency_type_id, dependency_type_name;
--- drop helper function
-drop function pcre_replace(string, string, string, string);
 select 'duplicates in schemas', count(*), id from sys.schemas group by id 
having count(*) > 1;
 select 'duplicates in _tables', count(*), id from sys._tables group by id 
having count(*) > 1;
 select 'duplicates in tables', count(*), id from sys.tables group by id having 
count(*) > 1;
@@ -2257,7 +2253,6 @@ select 'null in fkeys.delete_action', de
 [ "sys.functions",     "sys",  "patindex",     "SYSTEM",       "patindex",     
"pcre", "Internal C",   "Scalar function",      false,  false,  false,  false,  
NULL,   "res_0",        "int",  31,     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",  "pause",        "SYSTEM",       "create 
procedure sys.pause(tag bigint) external name sysmon.pause;",   "sysmon",       
"MAL",  "Procedure",    true,   false,  false,  true,   NULL,   "tag",  
"bigint",       63,     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,   NULL,   NULL,   NULL,   NULL,   NULL    
]
 [ "sys.functions",     "sys",  "pause",        "SYSTEM",       "create 
procedure sys.pause(tag bigint, username string) external name sysmon.pause;",  
"sysmon",       "MAL",  "Procedure",    true,   false,  false,  true,   NULL,   
"tag",  "bigint",       63,     0,      "in",   "username",     "varchar",      
0,      0,      "in",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL    ]
-[ "sys.functions",     "sys",  "pcre_replace", "",     "create function 
pcre_replace(origin string, pat string, repl string, flags string) returns 
string external name pcre.replace;",        "pcre", "MAL",  "Scalar function",  
    false,  false,  false,  true,   NULL,   "result",       "varchar",      0,  
    0,      "out",  "origin",       "varchar",      0,      0,      "in",   
"pat",  "varchar",      0,      0,      "in",   "repl", "varchar",      0,      
0,      "in",   "flags",        "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    ]
 [ "sys.functions",     "sys",  "percent_rank", "SYSTEM",       "percent_rank", 
"sql",  "Internal C",   "Analytic function",    false,  false,  false,  true,   
NULL,   "res_0",        "double",       53,     0,      "out",  "arg_1",        
"any",  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",  "persist_unlogged",     "SYSTEM",       "create 
function sys.persist_unlogged(sname string, tname string) returns 
table(\"table\" string, \"table_id\" int, \"rowcount\" bigint) external name 
sql.persist_unlogged;",  "sql",  "MAL",  "Function returning a table",   true,  
 false,  false,  true,   NULL,   "table",        "varchar",      0,      0,     
 "out",  "table_id",     "int",  31,     0,      "out",  "rowcount",     
"bigint",       63,     0,      "out",  "sname",        "varchar",      0,      
0,      "in",   "tname",        "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    ]
 [ "sys.functions",     "sys",  "pi",   "SYSTEM",       "pi",   "mmath",        
"Internal C",   "Scalar function",      false,  false,  false,  false,  NULL,   
"res_0",        "double",       53,     0,      "out",  NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL    ]
diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -1506,6 +1506,7 @@ def coredumpctl(pid):
             out, err = p.communicate(timeout=60)
         except process.TimeoutExpired:
             p.kill()
+            out = err = ''
     os.unlink(name)
     s = []
     for l in out.split('\n'):
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to