Changeset: 57ef117cfd86 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=57ef117cfd86 Added Files: sql/test/emptydb-upgrade-chain-hge/Tests/check.SQL.py.src sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.err.int128 sql/test/emptydb-upgrade-chain-hge/Tests/dump.stable.err.int128 sql/test/emptydb-upgrade-chain-hge/Tests/package.stable.err.int128 sql/test/emptydb-upgrade-chain-hge/Tests/package.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/unpackage.stable.err.int128 sql/test/emptydb-upgrade-chain-hge/Tests/unpackage.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.err.int128 sql/test/emptydb-upgrade-chain/Tests/check.SQL.py.src sql/test/emptydb-upgrade-hge/Tests/check.SQL.py.src sql/test/emptydb-upgrade-hge/Tests/check.stable.err.int128 sql/test/emptydb-upgrade-hge/Tests/dump.stable.err.int128 sql/test/emptydb-upgrade-hge/Tests/unpackage.stable.err.int128 sql/test/emptydb-upgrade-hge/Tests/unpackage.stable.out.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.err.int128 sql/test/emptydb-upgrade/Tests/check.SQL.py.src sql/test/emptydb/Tests/check.SQL.py.src sql/test/emptydb/Tests/package-hge.stable.err.int128 sql/test/emptydb/Tests/package-hge.stable.out.int128 Removed Files: sql/test/emptydb-upgrade-chain-hge/Tests/check.SQL.py sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.err sql/test/emptydb-upgrade-chain-hge/Tests/dump.stable.err sql/test/emptydb-upgrade-chain-hge/Tests/package.stable.err sql/test/emptydb-upgrade-chain-hge/Tests/package.stable.out sql/test/emptydb-upgrade-chain-hge/Tests/unpackage.stable.err sql/test/emptydb-upgrade-chain-hge/Tests/unpackage.stable.out sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.err sql/test/emptydb-upgrade-chain/Tests/check.SQL.py sql/test/emptydb-upgrade-hge/Tests/check.SQL.py sql/test/emptydb-upgrade-hge/Tests/check.stable.err sql/test/emptydb-upgrade-hge/Tests/dump.stable.err sql/test/emptydb-upgrade-hge/Tests/unpackage.stable.err sql/test/emptydb-upgrade-hge/Tests/unpackage.stable.out sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.err sql/test/emptydb-upgrade/Tests/check.SQL.py sql/test/emptydb/Tests/check.SQL.py sql/test/emptydb/Tests/package-hge.stable.err sql/test/emptydb/Tests/package-hge.stable.out Modified Files: NT/rules.msc clients/Tests/All clients/Tests/SQL-dump.SQL.py clients/Tests/SQL-dump.stable.out clients/Tests/SQL-dump.stable.out.int128 clients/mapiclient/dump.c gdk/gdk.h gdk/gdk_atoms.c gdk/gdk_bat.c gdk/gdk_logger.h geom/monetdb5/geom.c geom/monetdb5/geom.h geom/monetdb5/geom_upgrade.c java/ChangeLog.Jun2016 java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java monetdb5/modules/atoms/blob.c sql/backends/monet5/sql_upgrades.c sql/jdbc/tests/Tests/BugDatabaseMetaData_Bug_3356.stable.out sql/jdbc/tests/Tests/Test_Dobjects.stable.out sql/storage/bat/bat_logger.c sql/storage/bat/bat_storage.c sql/test/emptydb-upgrade-chain-hge/Tests/All sql/test/emptydb-upgrade-chain-hge/Tests/check.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/All sql/test/emptydb-upgrade-chain/Tests/check.stable.out sql/test/emptydb-upgrade-chain/Tests/check.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-hge/Tests/All sql/test/emptydb-upgrade-hge/Tests/check.stable.out.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/All sql/test/emptydb-upgrade/Tests/check.stable.out sql/test/emptydb-upgrade/Tests/check.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/All sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.int128 sql/test/emptydb/updatetests sql/test/leaks/Tests/check3.stable.out sql/test/leaks/Tests/check4.stable.out sql/test/leaks/Tests/check5.stable.out sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: default Log Message:
Merge with Jun2016 branch. diffs (truncated from 80971 to 300 lines): diff --git a/NT/rules.msc b/NT/rules.msc --- a/NT/rules.msc +++ b/NT/rules.msc @@ -274,19 +274,21 @@ create_winconfig_conds_new_py: $(ECHO) # > "$(TOPDIR)\winconfig_conds_new.py" !IFDEF BITS32 $(ECHO) BITS32_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py" + $(ECHO) BITS64OID32_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py" !ELSE $(ECHO) BITS32_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py" -!ENDIF !IFDEF BITS64 $(ECHO) BITS64_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py" -!ELSE - $(ECHO) BITS64_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py" -!ENDIF -!IFDEF BITS64OID32 +!IFDEF MONET_OID32 $(ECHO) BITS64OID32_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py" !ELSE $(ECHO) BITS64OID32_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py" !ENDIF +!ELSE + $(ECHO) BITS64_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py" + $(ECHO) BITS64OID32_FALSE='' >> "$(TOPDIR)\winconfig_conds_new.py" +!ENDIF +!ENDIF !IFDEF CROSS_COMPILING $(ECHO) CROSS_COMPILING_FALSE='#' >> "$(TOPDIR)\winconfig_conds_new.py" !ELSE diff --git a/clients/Tests/All b/clients/Tests/All --- a/clients/Tests/All +++ b/clients/Tests/All @@ -1,4 +1,4 @@ exports -HAVE_FITS&HAVE_GEOM&HAVE_GSL&HAVE_LIBR&!HAVE_LIDAR&!HAVE_SHP&HAVE_NETCDF&HAVE_SAMTOOLS&HAVE_SPHINXCLIENT?MAL-signatures -!BITS32&!BITS64OID32&HAVE_FITS&HAVE_GEOM&HAVE_GSL&!HAVE_LIDAR&!HAVE_SHP&HAVE_NETCDF&HAVE_SAMTOOLS?SQL-dump +HAVE_FITS&HAVE_GEOM&HAVE_GSL&HAVE_LIBR&!HAVE_LIDAR&HAVE_NETCDF&HAVE_SAMTOOLS&!HAVE_SHP&HAVE_SPHINXCLIENT?MAL-signatures +!BITS32&!BITS64OID32&HAVE_FITS&HAVE_GEOM&HAVE_GSL&!HAVE_LIDAR&HAVE_NETCDF&HAVE_PCRE&!HAVE_SHP&HAVE_SAMTOOLS?SQL-dump MERCURIAL?malcheck diff --git a/clients/Tests/SQL-dump.SQL.py b/clients/Tests/SQL-dump.SQL.py --- a/clients/Tests/SQL-dump.SQL.py +++ b/clients/Tests/SQL-dump.SQL.py @@ -62,14 +62,16 @@ sys.stderr.write(err) # they are too volatile, and if it makes sense, dump an identifier # from a referenced table out = ''' +-- helper function +create function pcre_replace(origin string, pat string, repl string, flags string) returns string external name pcre.replace; -- schemas select name, authorization, owner, system from sys.schemas order by name; -- _tables -select s.name, t.name, t.query, t.type, t.system, t.commit_action, t.access from sys._tables t left outer join sys.schemas s on t.schema_id = s.id order by s.name, t.name; +select s.name, t.name, replace(replace(pcre_replace(pcre_replace(pcre_replace(t.query, '--.*\n', '', ''), '[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', ')') as query, t.type, t.system, t.commit_action, t.access from sys._tables t left outer join sys.schemas s on t.schema_id = s.id order by s.name, t.name; -- _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; -- functions -select s.name, f.name, f.func, f.mod, f.language, f.type, f.side_effect, f.varres, f.vararg from sys.functions f left outer join sys.schemas s on f.schema_id = s.id order by s.name, f.name, f.func; +select s.name, f.name, replace(replace(pcre_replace(pcre_replace(pcre_replace(f.func, '--.*\n', '', ''), '[ \t\n]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', ')') as query, f.mod, f.language, f.type, f.side_effect, f.varres, f.vararg from sys.functions f left outer join sys.schemas s on f.schema_id = s.id order by s.name, f.name, query; -- args select f.name, a.name, a.type, a.type_digits, a.type_scale, a.inout, a.number from sys.args a left outer join sys.functions f on a.func_id = f.id order by f.name, a.func_id, a.number; -- auths @@ -79,7 +81,15 @@ select server, port, db, db_alias, user, -- db_user_info select u.name, u.fullname, s.name from sys.db_user_info u left outer join sys.schemas s on u.default_schema = s.id order by u.name; -- dependencies -select count(*) from sys.dependencies; +select s1.name, f1.name, s2.name, f2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from sys.dependencies d, sys.functions f1, sys.functions f2, sys.schemas s1, sys.schemas s2 where d.id = f1.id and d.depend_id = f2.id and f1.schema_id = s1.id and f2.schema_id = s2.id order by s2.name, f2.name, s1.name, f1.name; +select s1.name, t.name, s2.name, f.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from sys.dependencies d, sys._tables t, sys.schemas s1, sys.functions f, sys.schemas s2 where d.id = t.id and d.depend_id = f.id and t.schema_id = s1.id and f.schema_id = s2.id order by s2.name, f.name, s1.name, t.name; +select s1.name, t.name, c.name, s2.name, f.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from sys.dependencies d, sys._columns c, sys._tables t, sys.schemas s1, sys.functions f, sys.schemas s2 where d.id = c.id and d.depend_id = f.id and c.table_id = t.id and t.schema_id = s1.id and f.schema_id = s2.id order by s2.name, f.name, s1.name, t.name, c.name; +select s1.name, f1.name, s2.name, t2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from schemas s1, functions f1, schemas s2, _tables t2, dependencies d where d.id = f1.id and f1.schema_id = s1.id and d.depend_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, s1.name, f1.name; +select s1.name, t1.name, s2.name, t2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from schemas s1, _tables t1, schemas s2, _tables t2, dependencies d where d.id = t1.id and t1.schema_id = s1.id and d.depend_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, s1.name, t1.name; +select s1.name, t1.name, c1.name, s2.name, t2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from schemas s1, _tables t1, _columns c1, schemas s2, _tables t2, dependencies d where d.id = c1.id and c1.table_id = t1.id and t1.schema_id = s1.id and d.depend_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, s1.name, t1.name; +select s1.name, t1.name, c1.name, s2.name, t2.name, k2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from dependencies d, _tables t1, _tables t2, schemas s1, schemas s2, _columns c1, keys k2 where d.id = c1.id and d.depend_id = k2.id and c1.table_id = t1.id and t1.schema_id = s1.id and k2.table_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, k2.name, s1.name, t1.name, c1.name; +select s1.name, t1.name, c1.name, s2.name, t2.name, i2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from dependencies d, _tables t1, _tables t2, schemas s1, schemas s2, _columns c1, idxs i2 where d.id = c1.id and d.depend_id = i2.id and c1.table_id = t1.id and t1.schema_id = s1.id and i2.table_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, i2.name, s1.name, t1.name, c1.name; +select t.systemname, t.sqlname, s.name, f.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from types t, functions f, schemas s, dependencies d where d.id = t.id and d.depend_id = f.id and f.schema_id = s.id order by s.name, f.name, t.systemname, t.sqlname; -- idxs select t.name, i.name, i.type from sys.idxs i left outer join sys._tables t on t.id = i.table_id order by t.name, i.name; -- keys @@ -107,6 +117,14 @@ select t.name, g.name, g.time, g.orienta select s.name, t.systemname, t.sqlname, t.digits, t.scale, t.radix, t.eclass from sys.types t left outer join sys.schemas s on s.id = t.schema_id order by s.name, t.systemname, t.sqlname, t.digits, t.scale, t.radix, t.eclass; -- user_role select a1.name, a2.name from sys.auths a1, sys.auths a2, sys.user_role ur where a1.id = ur.login_id and a2.id = ur.role_id order by a1.name, a2.name; +-- keywords +select keyword from sys.keywords order by keyword; +-- table_types +select table_type_id, table_type_name from sys.table_types order by table_type_id, table_type_name; +-- dependency_types +select 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); ''' sys.stdout.write(out) @@ -116,10 +134,5 @@ clt = process.client('sql', interactive out, err = clt.communicate(out) -# do some normalization of the output: -# remove SQL comments, collapse multiple white space into a single space -out = re.sub(r'--.*?(?:\\n)+', '', out) -out = re.sub(r'(?:\\n|\\t| )+', ' ', out) - sys.stdout.write(out) sys.stderr.write(err) diff --git a/clients/Tests/SQL-dump.stable.out b/clients/Tests/SQL-dump.stable.out --- a/clients/Tests/SQL-dump.stable.out +++ b/clients/Tests/SQL-dump.stable.out @@ -927,12 +927,6 @@ create function sys.hashsize(b boolean, create function sys.heapsize(tpe string, i bigint, w int) returns bigint begin if tpe <> 'varchar' and tpe <> 'clob' then return 0; end if; return 10240 + i * w; end; create function "host" (p inet) returns clob external name inet."host"; create function "hostmask" (p inet) returns inet external name inet."hostmask"; -ilike -ilike -ilike -ilike -ilike -ilike create filter function "ilike"(val string, pat string, esc string) external name algebra."ilike"; create filter function "ilike"(val string, pat string) external name algebra."ilike"; create function sys.imprintsize(i bigint, nme string) returns bigint begin if nme = 'boolean' or nme = 'tinyint' or nme = 'smallint' or nme = 'int' or nme = 'bigint' or nme = 'hugeint' or nme = 'decimal' or nme = 'date' or nme = 'timestamp' or nme = 'real' or nme = 'double' then return cast(i * 0.12 as bigint); end if ; return 0; end; @@ -940,26 +934,8 @@ create function internaltransform(geom g create function isaurl(theurl url) returns bool external name url."isaURL"; create function sys.isauuid(u uuid) returns uuid external name uuid."isaUUID"; create function sys.isauuid(u string) returns uuid external name uuid."isaUUID"; -mbrLeft -mbrLeft -<< -<< -<< -<< -<< -<< -<< -<< -<< -<< create function "left_shift"(i1 inet, i2 inet) returns boolean external name inet."<<"; create function "left_shift_assign"(i1 inet, i2 inet) returns boolean external name inet."<<="; -like -like -like -like -like -like create filter function "like"(val string, pat string, esc string) external name algebra."like"; create filter function "like"(val string, pat string) external name algebra."like"; @@ -1022,18 +998,6 @@ create procedure sys.resume(tag int) ext create procedure sys.resume(tag bigint) external name sql.sysmon_resume; create procedure reuse(sys string, tab string) external name sql.reuse; create function reverse(src string) returns string external name udf.reverse; -mbrRight -mbrRight ->> ->> ->> ->> ->> ->> ->> ->> ->> ->> create function "right_shift"(i1 inet, i2 inet) returns boolean external name inet.">>"; create function "right_shift_assign"(i1 inet, i2 inet) returns boolean external name inet.">>="; create function sys.sessions() returns table("user" string, "login" timestamp, "sessiontimeout" bigint, "lastcommand" timestamp, "querytimeout" bigint, "active" bool) external name sql.sessions; @@ -1224,14 +1188,20 @@ create function zorder_decode_x(z oid) r create function zorder_decode_y(z oid) returns integer external name zorder.decode_y; create function zorder_encode(x integer, y integer) returns oid external name zorder.encode; +-- helper function +create function pcre_replace(origin string, pat string, repl string, flags string) returns string external name pcre.replace; -- schemas select name, authorization, owner, system from sys.schemas order by name; -- _tables -select s.name, t.name, t.query, t.type, t.system, t.commit_action, t.access from sys._tables t left outer join sys.schemas s on t.schema_id = s.id order by s.name, t.name; +select s.name, t.name, replace(replace(pcre_replace(pcre_replace(pcre_replace(t.query, '--.* +', '', ''), '[ +]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', ')') as query, t.type, t.system, t.commit_action, t.access from sys._tables t left outer join sys.schemas s on t.schema_id = s.id order by s.name, t.name; -- _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; -- functions -select s.name, f.name, f.func, f.mod, f.language, f.type, f.side_effect, f.varres, f.vararg from sys.functions f left outer join sys.schemas s on f.schema_id = s.id order by s.name, f.name, f.func; +select s.name, f.name, replace(replace(pcre_replace(pcre_replace(pcre_replace(f.func, '--.* +', '', ''), '[ +]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', ')') as query, f.mod, f.language, f.type, f.side_effect, f.varres, f.vararg from sys.functions f left outer join sys.schemas s on f.schema_id = s.id order by s.name, f.name, query; -- args select f.name, a.name, a.type, a.type_digits, a.type_scale, a.inout, a.number from sys.args a left outer join sys.functions f on a.func_id = f.id order by f.name, a.func_id, a.number; -- auths @@ -1241,7 +1211,15 @@ select server, port, db, db_alias, user, -- db_user_info select u.name, u.fullname, s.name from sys.db_user_info u left outer join sys.schemas s on u.default_schema = s.id order by u.name; -- dependencies -select count(*) from sys.dependencies; +select s1.name, f1.name, s2.name, f2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from sys.dependencies d, sys.functions f1, sys.functions f2, sys.schemas s1, sys.schemas s2 where d.id = f1.id and d.depend_id = f2.id and f1.schema_id = s1.id and f2.schema_id = s2.id order by s2.name, f2.name, s1.name, f1.name; +select s1.name, t.name, s2.name, f.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from sys.dependencies d, sys._tables t, sys.schemas s1, sys.functions f, sys.schemas s2 where d.id = t.id and d.depend_id = f.id and t.schema_id = s1.id and f.schema_id = s2.id order by s2.name, f.name, s1.name, t.name; +select s1.name, t.name, c.name, s2.name, f.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from sys.dependencies d, sys._columns c, sys._tables t, sys.schemas s1, sys.functions f, sys.schemas s2 where d.id = c.id and d.depend_id = f.id and c.table_id = t.id and t.schema_id = s1.id and f.schema_id = s2.id order by s2.name, f.name, s1.name, t.name, c.name; +select s1.name, f1.name, s2.name, t2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from schemas s1, functions f1, schemas s2, _tables t2, dependencies d where d.id = f1.id and f1.schema_id = s1.id and d.depend_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, s1.name, f1.name; +select s1.name, t1.name, s2.name, t2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from schemas s1, _tables t1, schemas s2, _tables t2, dependencies d where d.id = t1.id and t1.schema_id = s1.id and d.depend_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, s1.name, t1.name; +select s1.name, t1.name, c1.name, s2.name, t2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from schemas s1, _tables t1, _columns c1, schemas s2, _tables t2, dependencies d where d.id = c1.id and c1.table_id = t1.id and t1.schema_id = s1.id and d.depend_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, s1.name, t1.name; +select s1.name, t1.name, c1.name, s2.name, t2.name, k2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from dependencies d, _tables t1, _tables t2, schemas s1, schemas s2, _columns c1, keys k2 where d.id = c1.id and d.depend_id = k2.id and c1.table_id = t1.id and t1.schema_id = s1.id and k2.table_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, k2.name, s1.name, t1.name, c1.name; +select s1.name, t1.name, c1.name, s2.name, t2.name, i2.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from dependencies d, _tables t1, _tables t2, schemas s1, schemas s2, _columns c1, idxs i2 where d.id = c1.id and d.depend_id = i2.id and c1.table_id = t1.id and t1.schema_id = s1.id and i2.table_id = t2.id and t2.schema_id = s2.id order by s2.name, t2.name, i2.name, s1.name, t1.name, c1.name; +select t.systemname, t.sqlname, s.name, f.name, case d.depend_type when 1 then 'SCHEMA_DEPENDENCY' when 2 then 'TABLE_DEPENDENCY' when 3 then 'COLUMN_DEPENDENCY' when 4 then 'KEY_DEPENDENCY' when 5 then 'VIEW_DEPENDENCY' when 6 then 'USER_DEPENDENCY' when 7 then 'FUNC_DEPENDENCY' when 8 then 'TRIGGER_DEPENDENCY' when 9 then 'OWNER_DEPENDENCY' when 10 then 'INDEX_DEPENDENCY' when 11 then 'FKEY_DEPENDENCY' when 12 then 'SEQ_DEPENDENCY' when 13 then 'PROC_DEPENDENCY' when 14 then 'BEDROPPED_DEPENDENCY' when 15 then 'TYPE_DEPENDENCY' end from types t, functions f, schemas s, dependencies d where d.id = t.id and d.depend_id = f.id and f.schema_id = s.id order by s.name, f.name, t.systemname, t.sqlname; -- idxs select t.name, i.name, i.type from sys.idxs i left outer join sys._tables t on t.id = i.table_id order by t.name, i.name; -- keys @@ -1269,6 +1247,15 @@ select t.name, g.name, g.time, g.orienta select s.name, t.systemname, t.sqlname, t.digits, t.scale, t.radix, t.eclass from sys.types t left outer join sys.schemas s on s.id = t.schema_id order by s.name, t.systemname, t.sqlname, t.digits, t.scale, t.radix, t.eclass; -- user_role select a1.name, a2.name from sys.auths a1, sys.auths a2, sys.user_role ur where a1.id = ur.login_id and a2.id = ur.role_id order by a1.name, a2.name; +-- keywords +select keyword from sys.keywords order by keyword; +-- table_types +select table_type_id, table_type_name from sys.table_types order by table_type_id, table_type_name; +-- dependency_types +select 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); +#create function pcre_replace(origin string, pat string, repl string, flags string) returns string external name pcre.replace; #select name, authorization, owner, system from sys.schemas order by name; % sys.schemas, sys.schemas, sys.schemas, sys.schemas # table_name % name, authorization, owner, system # name @@ -1279,11 +1266,13 @@ select a1.name, a2.name from sys.auths a [ "profiler", 3, 3, true ] [ "sys", 2, 3, true ] [ "tmp", 2, 3, true ] -#select s.name, t.name, t.query, t.type, t.system, t.commit_action, t.access from sys._tables t left outer join sys.schemas s on t.schema_id = s.id order by s.name, t.name; -% .s, .t, .t, .t, .t, .t, .t # table_name +#select s.name, t.name, replace(replace(pcre_replace(pcre_replace(pcre_replace(t.query, '--.* +#', '', ''), '[ +#]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', ')') as query, t.type, t.system, t.commit_action, t.access from sys._tables t left outer join sys.schemas s on t.schema_id = s.id order by s.name, t.name; +% .s, .t, .L, .t, .t, .t, .t # table_name % name, name, query, type, system, commit_action, access # name % varchar, varchar, varchar, smallint, boolean, smallint, smallint # type -% 3, 17, 613, 1, 5, 1, 1 # length +% 3, 17, 597, 1, 5, 1, 1 # length [ "bam", "export", NULL, 0, true, 0, 0 ] [ "bam", "files", NULL, 0, true, 0, 0 ] [ "bam", "pg", NULL, 0, true, 0, 0 ] @@ -1300,7 +1289,7 @@ select a1.name, a2.name from sys.auths a [ "sys", "dependency_types", NULL, 0, true, 0, 0 ] [ "sys", "environment", "create view sys.environment as select * from sys.environment();", 1, true, 0, 0 ] [ "sys", "functions", NULL, 0, true, 0, 0 ] -[ "sys", "geometry_columns", "create view geometry_columns as select e.value as f_table_catalog, s.name as f_table_schema, y.f_table_name, y.f_geometry_column, y.coord_dimension, y.srid, y.type from schemas s, environment e, ( select t.schema_id, t.name as f_table_name, x.name as f_geometry_column, has_z(info)+has_m(info)+2 as coord_dimension, srid, get_type(info, 0) as type from tables t, ( select name, table_id, type_digits as info, type_scale as srid from columns where type in ( select distinct sqlname from types where systemname='wkb') ) as x where t.id=x.table_id ) y where y.schema_id=s.id and e.name='gdk_dbname';", 1, true, 0, 0 ] +[ "sys", "geometry_columns", "create view geometry_columns as select e.value as f_table_catalog, s.name as f_table_schema, y.f_table_name, y.f_geometry_column, y.coord_dimension, y.srid, y.type from schemas s, environment e, (select t.schema_id, t.name as f_table_name, x.name as f_geometry_column, has_z(info)+has_m(info)+2 as coord_dimension, srid, get_type(info, 0) as type from tables t, (select name, table_id, type_digits as info, type_scale as srid from columns where type in (select distinct sqlname from types where systemname='wkb')) as x where t.id=x.table_id) y where y.schema_id=s.id and e.name='gdk_dbname';", 1, true, 0, 0 ] [ "sys", "idxs", NULL, 0, true, 0, 0 ] [ "sys", "keys", NULL, 0, true, 0, 0 ] [ "sys", "keywords", NULL, 0, true, 0, 0 ] @@ -1718,11 +1707,13 @@ select a1.name, a2.name from sys.auths a [ "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 ] -#select s.name, f.name, f.func, f.mod, f.language, f.type, f.side_effect, f.varres, f.vararg from sys.functions f left outer join sys.schemas s on f.schema_id = s.id order by s.name, f.name, f.func; -% .s, .f, .f, .f, .f, .f, .f, .f, .f # table_name -% name, name, func, mod, language, type, side_effect, varres, vararg # name +#select s.name, f.name, replace(replace(pcre_replace(pcre_replace(pcre_replace(f.func, '--.* +#', '', ''), '[ +#]+', ' ', 'm'), '^ ', '', ''), '( ', '('), ' )', ')') as query, f.mod, f.language, f.type, f.side_effect, f.varres, f.vararg from sys.functions f left outer join sys.schemas s on f.schema_id = s.id order by s.name, f.name, query; +% .s, .f, .L, .f, .f, .f, .f, .f, .f # table_name +% name, name, query, mod, language, type, side_effect, varres, vararg # name % varchar, varchar, varchar, varchar, int, int, boolean, boolean, boolean # type -% 8, 35, 816, 9, 1, 1, 5, 5, 5 # length +% 8, 35, 794, 9, 1, 1, 5, 5, 5 # length [ "bam", "bam_drop_file", "create procedure bam.bam_drop_file(file_id bigint, dbschema smallint) external name bam.bam_drop_file;", "bam", 1, 2, true, false, false ] [ "bam", "bam_export", "create procedure bam.bam_export(output_path string) external name bam.bam_export;", "bam", 1, 2, true, false, false ] [ "bam", "bam_flag", "create function bam.bam_flag(flag smallint, name string) returns boolean external name bam.bam_flag;", "bam", 1, 1, false, false, false ] @@ -1753,8 +1744,8 @@ select a1.name, a2.name from sys.auths a [ "json", "text", "create function json.text(js json) returns string external name json.text;", "json", 1, 1, false, false, false ] [ "json", "text", "create function json.text(js json, e string) returns string external name json.text;", "json", 1, 1, false, false, false ] [ "json", "text", "create function json.text(js string) returns string external name json.text;", "json", 1, 1, false, false, false ] -[ "json", "tojsonarray", "create aggregate json.tojsonarray( x double ) returns string external name aggr.jsonaggr;", "aggr", 1, 3, false, false, false ] -[ "json", "tojsonarray", "create aggregate json.tojsonarray( x string ) returns string external name aggr.jsonaggr;", "aggr", 1, 3, false, false, false ] +[ "json", "tojsonarray", "create aggregate json.tojsonarray(x double) returns string external name aggr.jsonaggr;", "aggr", 1, 3, false, false, false ] +[ "json", "tojsonarray", "create aggregate json.tojsonarray(x string) returns string external name aggr.jsonaggr;", "aggr", 1, 3, false, false, false ] [ "json", "valuearray", "create function json.valuearray(js json) returns json external name json.valuearray;", "json", 1, 1, false, false, false ] [ "profiler", "setheartbeat", "create procedure profiler.setheartbeat(beat int) external name profiler.setheartbeat;", "profiler", 1, 2, true, false, false ] [ "profiler", "setpoolsize", "create procedure profiler.setpoolsize(poolsize int) external name profiler.setpoolsize;", "profiler", 1, 2, true, false, false ] @@ -1898,7 +1889,7 @@ select a1.name, a2.name from sys.auths a [ "sys", "dayofmonth", "day", "mtime", 0, 1, false, false, false ] [ "sys", "dayofweek", "dayofweek", "mtime", 0, 1, false, false, false ] [ "sys", "dayofyear", "dayofyear", "mtime", 0, 1, false, false, false ] -[ "sys", "db_users", "CREATE FUNCTION db_users () RETURNS TABLE( name varchar(2048)) EXTERNAL NAME sql.db_users;", "sql", 2, 5, false, false, false ] +[ "sys", "db_users", "CREATE FUNCTION db_users () RETURNS TABLE(name varchar(2048)) EXTERNAL NAME sql.db_users;", "sql", 2, 5, false, false, false ] [ "sys", "debug", "create function sys.debug(debug int) returns integer external name mdb.\"setDebug\";", "mdb", 1, 1, false, false, false ] [ "sys", "degrees", "create function degrees(r double) returns double return r*180/pi();", "user", 2, 1, false, false, false ] [ "sys", "dense_rank", "dense_rank", "sql", 0, 6, false, false, false ] @@ -1930,13 +1921,13 @@ select a1.name, a2.name from sys.auths a [ "sys", "editdistance2", "editdistance2", "txtsim", 0, 1, false, false, false ] [ "sys", "editdistance2", "editdistance2", "txtsim", 0, 1, false, false, false ] [ "sys", "editdistance2", "editdistance2", "txtsim", 0, 1, false, false, false ] -[ "sys", "env", "CREATE FUNCTION env () RETURNS TABLE( name varchar(1024), value varchar(2048)) EXTERNAL NAME sql.sql_environment;", "sql", 2, 5, false, false, false ] +[ "sys", "env", "CREATE FUNCTION env () RETURNS TABLE(name varchar(1024), value varchar(2048)) EXTERNAL NAME sql.sql_environment;", "sql", 2, 5, false, false, false ] [ "sys", "environment", "create function sys.environment() returns table (\"name\" string, value string) external name sql.sql_environment;", "sql", 1, 5, false, false, false ] [ "sys", "epoch", "create function sys.\"epoch\"(sec bigint) returns timestamp external name timestamp.\"epoch\";", "timestamp", 1, 1, false, false, false ] [ "sys", "epoch", "create function sys.\"epoch\"(sec int) returns timestamp external name timestamp.\"epoch\";", "timestamp", 1, 1, false, false, false ] [ "sys", "epoch", "create function sys.\"epoch\"(ts timestamp with time zone) returns int external name timestamp.\"epoch\";", "timestamp", 1, 1, false, false, false ] [ "sys", "epoch", "create function sys.\"epoch\"(ts timestamp) returns int external name timestamp.\"epoch\";", "timestamp", 1, 1, false, false, false ] -[ "sys", "evalalgebra", "create procedure sys.evalalgebra( ra_stmt string, opt bool) external name sql.\"evalAlgebra\";", "sql", 1, 2, true, false, false ] +[ "sys", "evalalgebra", "create procedure sys.evalalgebra(ra_stmt string, opt bool) external name sql.\"evalAlgebra\";", "sql", 1, 2, true, false, false ] _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list