Changeset: f4c065454856 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f4c065454856
Modified Files:
        sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128
        sql/test/emptydb-upgrade-chain/Tests/check.stable.out
        sql/test/emptydb-upgrade-chain/Tests/check.stable.out.32bit
        sql/test/emptydb-upgrade-chain/Tests/check.stable.out.int128
        sql/test/emptydb-upgrade-hge/Tests/check.stable.out.int128
        sql/test/emptydb-upgrade/Tests/check.stable.out
        sql/test/emptydb-upgrade/Tests/check.stable.out.32bit
        sql/test/emptydb-upgrade/Tests/check.stable.out.int128
        sql/test/emptydb/Tests/check.SQL.py
        sql/test/emptydb/Tests/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.32bit
        sql/test/emptydb/Tests/check.stable.out.int128
Branch: Jul2017
Log Message:

Add schema name to defined SQL functions without MAL implementation.
Also use SPLIT_PART instead of SPLITPART since the former is in the grammar.


diffs (truncated from 331 to 300 lines):

diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128 
b/sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128
@@ -1193,7 +1193,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1732,11 +1732,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
 #arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
 #arg1 (id, id0, name0, type0, type_digits0, type_scale0, inout0, id1, name1, 
type1, type_digits1, type_scale1, inout1) as (select arg0.*, a1.id, a1.name, 
a1.type, a1.type_digits, a1.type_scale, a1.inout from arg0 left outer join args 
a1 on a1.func_id = arg0.id and a1.number = 1),
diff --git a/sql/test/emptydb-upgrade-chain/Tests/check.stable.out 
b/sql/test/emptydb-upgrade-chain/Tests/check.stable.out
--- a/sql/test/emptydb-upgrade-chain/Tests/check.stable.out
+++ b/sql/test/emptydb-upgrade-chain/Tests/check.stable.out
@@ -1179,7 +1179,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1718,11 +1718,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
 #arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
 #arg1 (id, id0, name0, type0, type_digits0, type_scale0, inout0, id1, name1, 
type1, type_digits1, type_scale1, inout1) as (select arg0.*, a1.id, a1.name, 
a1.type, a1.type_digits, a1.type_scale, a1.inout from arg0 left outer join args 
a1 on a1.func_id = arg0.id and a1.number = 1),
diff --git a/sql/test/emptydb-upgrade-chain/Tests/check.stable.out.32bit 
b/sql/test/emptydb-upgrade-chain/Tests/check.stable.out.32bit
--- a/sql/test/emptydb-upgrade-chain/Tests/check.stable.out.32bit
+++ b/sql/test/emptydb-upgrade-chain/Tests/check.stable.out.32bit
@@ -1183,7 +1183,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1722,11 +1722,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
 #arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
 #arg1 (id, id0, name0, type0, type_digits0, type_scale0, inout0, id1, name1, 
type1, type_digits1, type_scale1, inout1) as (select arg0.*, a1.id, a1.name, 
a1.type, a1.type_digits, a1.type_scale, a1.inout from arg0 left outer join args 
a1 on a1.func_id = arg0.id and a1.number = 1),
diff --git a/sql/test/emptydb-upgrade-chain/Tests/check.stable.out.int128 
b/sql/test/emptydb-upgrade-chain/Tests/check.stable.out.int128
--- a/sql/test/emptydb-upgrade-chain/Tests/check.stable.out.int128
+++ b/sql/test/emptydb-upgrade-chain/Tests/check.stable.out.int128
@@ -1193,7 +1193,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1732,11 +1732,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
 #arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
 #arg1 (id, id0, name0, type0, type_digits0, type_scale0, inout0, id1, name1, 
type1, type_digits1, type_scale1, inout1) as (select arg0.*, a1.id, a1.name, 
a1.type, a1.type_digits, a1.type_scale, a1.inout from arg0 left outer join args 
a1 on a1.func_id = arg0.id and a1.number = 1),
diff --git a/sql/test/emptydb-upgrade-hge/Tests/check.stable.out.int128 
b/sql/test/emptydb-upgrade-hge/Tests/check.stable.out.int128
--- a/sql/test/emptydb-upgrade-hge/Tests/check.stable.out.int128
+++ b/sql/test/emptydb-upgrade-hge/Tests/check.stable.out.int128
@@ -1193,7 +1193,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1732,11 +1732,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
 #arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
 #arg1 (id, id0, name0, type0, type_digits0, type_scale0, inout0, id1, name1, 
type1, type_digits1, type_scale1, inout1) as (select arg0.*, a1.id, a1.name, 
a1.type, a1.type_digits, a1.type_scale, a1.inout from arg0 left outer join args 
a1 on a1.func_id = arg0.id and a1.number = 1),
diff --git a/sql/test/emptydb-upgrade/Tests/check.stable.out 
b/sql/test/emptydb-upgrade/Tests/check.stable.out
--- a/sql/test/emptydb-upgrade/Tests/check.stable.out
+++ b/sql/test/emptydb-upgrade/Tests/check.stable.out
@@ -1179,7 +1179,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1718,11 +1718,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
 #arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
 #arg1 (id, id0, name0, type0, type_digits0, type_scale0, inout0, id1, name1, 
type1, type_digits1, type_scale1, inout1) as (select arg0.*, a1.id, a1.name, 
a1.type, a1.type_digits, a1.type_scale, a1.inout from arg0 left outer join args 
a1 on a1.func_id = arg0.id and a1.number = 1),
diff --git a/sql/test/emptydb-upgrade/Tests/check.stable.out.32bit 
b/sql/test/emptydb-upgrade/Tests/check.stable.out.32bit
--- a/sql/test/emptydb-upgrade/Tests/check.stable.out.32bit
+++ b/sql/test/emptydb-upgrade/Tests/check.stable.out.32bit
@@ -1183,7 +1183,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1722,11 +1722,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
 #arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
 #arg1 (id, id0, name0, type0, type_digits0, type_scale0, inout0, id1, name1, 
type1, type_digits1, type_scale1, inout1) as (select arg0.*, a1.id, a1.name, 
a1.type, a1.type_digits, a1.type_scale, a1.inout from arg0 left outer join args 
a1 on a1.func_id = arg0.id and a1.number = 1),
diff --git a/sql/test/emptydb-upgrade/Tests/check.stable.out.int128 
b/sql/test/emptydb-upgrade/Tests/check.stable.out.int128
--- a/sql/test/emptydb-upgrade/Tests/check.stable.out.int128
+++ b/sql/test/emptydb-upgrade/Tests/check.stable.out.int128
@@ -1193,7 +1193,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1732,11 +1732,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
 #arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
 #arg1 (id, id0, name0, type0, type_digits0, type_scale0, inout0, id1, name1, 
type1, type_digits1, type_scale1, inout1) as (select arg0.*, a1.id, a1.name, 
a1.type, a1.type_digits, a1.type_scale, a1.inout from arg0 left outer join args 
a1 on a1.func_id = arg0.id and a1.number = 1),
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
@@ -71,7 +71,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 '''
 # generate a monster query to get all functions with all their
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
@@ -1179,7 +1179,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1718,11 +1718,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
 #arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
 #arg1 (id, id0, name0, type0, type_digits0, type_scale0, inout0, id1, name1, 
type1, type_digits1, type_scale1, inout1) as (select arg0.*, a1.id, a1.name, 
a1.type, a1.type_digits, a1.type_scale, a1.inout from arg0 left outer join args 
a1 on a1.func_id = arg0.id and a1.number = 1),
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
@@ -1183,7 +1183,7 @@ select s.name, t.name, replace(replace(p
 -- _columns
 select t.name, c.name, c.type, c.type_digits, c.type_scale, c."default", 
c."null", c.number, c.storage from sys._tables t, sys._columns c where t.id = 
c.table_id order by t.name, c.number;
 -- external functions that don't reference existing MAL function (should be 
empty)
-with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
+with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
 -- args
 with
 arg0 (id, id0, name0, type0, type_digits0, type_scale0, inout0) as (select 
f.id, a0.id, a0.name, a0.type, a0.type_digits, a0.type_scale, a0.inout from 
sys.functions f left outer join args a0 on a0.func_id = f.id and a0.number = 0),
@@ -1722,11 +1722,11 @@ drop function pcre_replace(string, strin
 [ "users",     "name", "varchar",      1024,   0,      NULL,   true,   0,      
NULL    ]
 [ "users",     "fullname",     "varchar",      2024,   0,      NULL,   true,   
1,      NULL    ]
 [ "users",     "default_schema",       "int",  9,      0,      NULL,   true,   
2,      NULL    ]
-#with x(name,func) as (select name, splitpart(func, ' external name ', 2) from 
sys.functions where func like '% external name %' union select name, 
splitpart(func, ' EXTERNAL NAME ', 2) from sys.functions where func like '% 
EXTERNAL NAME %'), y(name,func) as (select name, trim(splitpart(func, ';', 1)) 
from x), z(name, mod, func) as (select name, trim(splitpart(func, '.', 1), 
'"'), trim(splitpart(func, '.', 2), '"') from y) select z.name, z.mod, z.func 
from z where z.mod || '.' || z.func not in (select m.module || '.' || 
m."function" from sys.malfunctions() m);
-% .z,  .z,     .z # table_name
-% name,        mod,    func # name
-% varchar,     varchar,        varchar # type
-% 0,   0,      0 # length
+#with x(name,func,schema_id) as (select name, split_part(func, ' external name 
', 2), schema_id from sys.functions where func like '% external name %' union 
select name, split_part(func, ' EXTERNAL NAME ', 2), schema_id from 
sys.functions where func like '% EXTERNAL NAME %'), y(name,func,schema_id) as 
(select name, trim(split_part(func, ';', 1)), schema_id from x), z(name, mod, 
func, schema_id) as (select name, trim(split_part(func, '.', 1), '"'), 
trim(split_part(func, '.', 2), '"'), schema_id from y) select s.name, z.name, 
z.mod, z.func from z, sys.schemas s where z.mod || '.' || z.func not in (select 
m.module || '.' || m."function" from sys.malfunctions() m) and z.schema_id = 
s.id;
+% sys.s,       .z,     .z,     .z # table_name
+% name,        name,   mod,    func # name
+% varchar,     varchar,        varchar,        varchar # type
+% 0,   0,      0,      0 # length
 #with
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to