Changeset: d2f4b3857070 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d2f4b3857070
Added Files:
        sql/test/BugTracker-2016/Tests/consolidated_table.Bug-3954.sql
        sql/test/BugTracker-2016/Tests/invalidcolumns.Bug-3968.sql
        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:
        .hgtags
        MonetDB.spec
        NT/installer32/MonetDB-ODBC-Installer.vdproj
        NT/installer32/MonetDB5-Geom-Module.vdproj
        NT/installer32/MonetDB5-SQL-Installer.vdproj
        NT/installer64/MonetDB-ODBC-Installer.vdproj
        NT/installer64/MonetDB5-Geom-Module.vdproj
        NT/installer64/MonetDB5-SQL-Installer.vdproj
        NT/monetdb_config.h.in
        NT/rules.msc
        clients/R/MonetDB.R/DESCRIPTION
        clients/Tests/All
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/SQL-dump.SQL.py
        clients/Tests/SQL-dump.stable.out
        clients/Tests/SQL-dump.stable.out.int128
        clients/Tests/exports.stable.out
        clients/mapiclient/dump.c
        clients/mapilib/mapi.rc
        clients/odbc/driver/driver.rc
        clients/odbc/winsetup/setup.rc
        clients/python2/setup.py
        clients/python3/setup.py
        configure.ag
        debian/changelog
        gdk/ChangeLog.Jun2016
        gdk/gdk.h
        gdk/gdk_aggr.c
        gdk/gdk_atoms.c
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_calc.c
        gdk/gdk_calc_compare.h
        gdk/gdk_group.c
        gdk/gdk_heap.c
        gdk/gdk_logger.c
        gdk/gdk_logger.h
        gdk/gdk_project.c
        gdk/gdk_system.c
        gdk/gdk_tm.c
        gdk/libbat.rc
        geom/monetdb5/geom.c
        geom/monetdb5/geom.h
        geom/monetdb5/geom_upgrade.c
        java/ChangeLog.Jun2016
        java/build.properties
        java/pom.xml
        java/release.txt
        java/src/main/java/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java
        libversions
        monetdb5/modules/atoms/batxml.c
        monetdb5/modules/atoms/blob.c
        monetdb5/modules/atoms/json.c
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/kernel/batmmath.c
        monetdb5/modules/kernel/batmmath.h
        monetdb5/modules/kernel/batmmath.mal
        monetdb5/modules/mal/batcalc.c
        monetdb5/modules/mal/bbp.c
        monetdb5/modules/mal/bbp.h
        monetdb5/modules/mal/bbp.mal
        monetdb5/optimizer/opt_deadcode.c
        monetdb5/tools/libmonetdb5.rc
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql.h
        sql/backends/monet5/sql.mal
        sql/backends/monet5/sql_statement.c
        sql/backends/monet5/sql_upgrades.c
        sql/common/sql_types.c
        sql/jdbc/tests/Tests/BugDatabaseMetaData_Bug_3356.stable.out
        sql/jdbc/tests/Tests/Test_Dobjects.stable.out
        sql/server/rel_select.c
        sql/server/sql_parser.y
        sql/storage/bat/bat_logger.c
        sql/storage/bat/bat_storage.c
        sql/storage/bat/bat_utils.c
        sql/storage/store.c
        sql/test/BugTracker-2016/Tests/All
        sql/test/BugTracker-2016/Tests/storagemodel.Bug-3923.sql
        sql/test/BugTracker-2016/Tests/storagemodel.Bug-3923.stable.err
        sql/test/BugTracker-2016/Tests/storagemodel.Bug-3923.stable.out
        sql/test/Dependencies/Tests/dependency_loop.stable.out
        sql/test/Tests/systemfunctions.stable.out
        sql/test/Tests/systemfunctions.stable.out.int128
        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/check0.stable.out
        sql/test/leaks/Tests/check0.stable.out.int128
        sql/test/leaks/Tests/check1.stable.out
        sql/test/leaks/Tests/check1.stable.out.int128
        sql/test/leaks/Tests/check2.stable.out
        sql/test/leaks/Tests/check2.stable.out.int128
        sql/test/leaks/Tests/check3.stable.out
        sql/test/leaks/Tests/check3.stable.out.int128
        sql/test/leaks/Tests/check4.stable.out
        sql/test/leaks/Tests/check4.stable.out.int128
        sql/test/leaks/Tests/check5.stable.out
        sql/test/leaks/Tests/check5.stable.out.int128
        sql/test/leaks/Tests/select1.stable.out
        sql/test/leaks/Tests/select1.stable.out.int128
        sql/test/leaks/Tests/select2.stable.out
        sql/test/leaks/Tests/select2.stable.out.int128
        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
        testing/Mfilter.py
        tools/embedded/build-on-windows.bat
        tools/embedded/build-rpkg.sh
        tools/embedded/rpackage/DESCRIPTION
        tools/mserver/mserver5.c
        vertoo.data
Branch: stratified_sampling
Log Message:

Merge default into stratified_sampling


diffs (truncated from 159607 to 300 lines):

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -618,3 +618,5 @@ 25c9f569add9c341d40920f30936890ae6ea68a8
 feec2e4020548d3137a0e946b7a4e29db5b9e14a Jul2015_15
 feec2e4020548d3137a0e946b7a4e29db5b9e14a Jul2015_SP3_release
 ee2d8c8d65c35ed022ca0785f30fcf4b051a542e Jun2016_root
+ee54e50fccb17db48bbfd983882e8491a869131c Jul2015_17
+ee54e50fccb17db48bbfd983882e8491a869131c Jul2015_SP3_release
diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -119,7 +119,7 @@ BuildRequires: geos-devel >= 3.0.0
 BuildRequires: gsl-devel
 %if %{?with_lidar:1}%{!?with_lidar:0}
 BuildRequires: liblas-devel gdal-devel libgeotiff-devel
-# Fedora 22 libas-devel does not depend on liblas:
+# Fedora 22 liblas-devel does not depend on liblas:
 BuildRequires: liblas
 %endif
 BuildRequires: libatomic_ops-devel
@@ -986,6 +986,29 @@ rm -f %{buildroot}%{_bindir}/Maddlog
 %postun -p /sbin/ldconfig
 
 %changelog
+* Thu Mar 24 2016 Sjoerd Mullender <sjo...@acm.org> - 11.21.17-20160324
+- Rebuilt.
+- BZ#2972: SQL URL functionality contains errors
+- BZ#3881: Server crashes on bulk load
+- BZ#3890: Window function + group by in subselect, rel2bin_project:
+  Assertion `0' failed
+- BZ#3891: MonetDB crashes when executing SQL with window function
+- BZ#3900: null handling in some sql statements is incorrect
+- BZ#3906: Multi-column 1-N table-function with mitosis produces different
+  column counts
+- BZ#3917: Date difference returns month_interval instead of day_interval
+- BZ#3938: Wrong error message on violating foreign key constraint
+- BZ#3941: Wrong coercion priority
+- BZ#3948: SQL: select * from sys.sys.table_name; is accepted but should
+  return an error
+- BZ#3951: extern table_funcs not visible from Windows DLL for extensions
+  like vaults (crashes)
+- BZ#3952: Stream table gives segfault
+- BZ#3953: MIN/MAX of a UUID column produces wrong results
+- BZ#3954: Consolidate table assertion error
+- BZ#3955: (incorrect) MAL loop instead of manifold triggered by simple
+  change in target list
+
 * Thu Mar 10 2016 Sjoerd Mullender <sjo...@acm.org> - 11.21.15-20160310
 - Rebuilt.
 - BZ#3549: bulk string operations very slow
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/R/MonetDB.R/DESCRIPTION b/clients/R/MonetDB.R/DESCRIPTION
--- a/clients/R/MonetDB.R/DESCRIPTION
+++ b/clients/R/MonetDB.R/DESCRIPTION
@@ -1,5 +1,5 @@
 Package: MonetDB.R
-Version: 1.0.1
+Version: 1.0.2
 Title: Connect MonetDB to R
 Authors@R: c(person("Hannes Muehleisen", role = c("aut", "cre"),email = 
"han...@cwi.nl"),
        person("Anthony Damico", role = "aut"),
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/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -2723,6 +2723,10 @@ command batstr.unicodeAt(s:bat[:str],ind
 address STRbatWChrAt;
 comment get a unicode character (as an int) from a string position.
 
+command batmmath.atan2(x:flt,y:bat[:flt]):bat[:flt] 
+address CMDscience_cst_bat_atan2_flt;
+command batmmath.atan2(x:dbl,y:bat[:dbl]):bat[:dbl] 
+address CMDscience_cst_bat_atan2_dbl;
 command batmmath.atan2(x:bat[:flt],y:flt):bat[:flt] 
 address CMDscience_bat_cst_atan2_flt;
 command batmmath.atan2(x:bat[:dbl],y:dbl):bat[:dbl] 
@@ -2779,6 +2783,10 @@ command batmmath.log(x:bat[:flt]):bat[:f
 address CMDscience_bat_flt_log;
 command batmmath.log(x:bat[:dbl]):bat[:dbl] 
 address CMDscience_bat_dbl_log;
+command batmmath.pow(x:flt,y:bat[:flt]):bat[:flt] 
+address CMDscience_cst_bat_pow_flt;
+command batmmath.pow(x:dbl,y:bat[:dbl]):bat[:dbl] 
+address CMDscience_cst_bat_pow_dbl;
 command batmmath.pow(x:bat[:flt],y:flt):bat[:flt] 
 address CMDscience_bat_cst_pow_flt;
 command batmmath.pow(x:bat[:dbl],y:dbl):bat[:dbl] 
@@ -31232,6 +31240,10 @@ command bbp.getIndex(b:bat[:any_2]):int
 address CMDbbpgetIndex;
 comment Retrieve the index in the BBP
 
+command bbp.setName(b:bat[:any_1],n:str):str 
+address CMDsetName;
+comment Rename a BAT
+
 command blob.blob(s:str):blob 
 address BLOBblob_fromstr;
 command blob.blob(s:blob):blob 
@@ -40430,6 +40442,11 @@ pattern sql.argRecord():str
 address SQLargRecord;
 comment Glue together the calling sequence
 
+inline function 
sql.all(b:bat[:any_1],gp:bat[:oid],gpe:bat[:oid],no_nil:bit):bat[:any_1];
+command sql.all(col:bat[:any_1]):any_1 
+address SQLall;
+comment if col contains exactly one value return this. Incase of more raise an 
exception else return nil
+
 pattern sql.affectedRows(mvc:int,nr:wrd):int 
 address mvc_affected_rows_wrap;
 comment export the number of affected rows by the current query
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -3174,6 +3174,10 @@ command batstr.unicodeAt(s:bat[:str],ind
 address STRbatWChrAt;
 comment get a unicode character (as an int) from a string position.
 
+command batmmath.atan2(x:flt,y:bat[:flt]):bat[:flt] 
+address CMDscience_cst_bat_atan2_flt;
+command batmmath.atan2(x:dbl,y:bat[:dbl]):bat[:dbl] 
+address CMDscience_cst_bat_atan2_dbl;
 command batmmath.atan2(x:bat[:flt],y:flt):bat[:flt] 
 address CMDscience_bat_cst_atan2_flt;
 command batmmath.atan2(x:bat[:dbl],y:dbl):bat[:dbl] 
@@ -3230,6 +3234,10 @@ command batmmath.log(x:bat[:flt]):bat[:f
 address CMDscience_bat_flt_log;
 command batmmath.log(x:bat[:dbl]):bat[:dbl] 
 address CMDscience_bat_dbl_log;
+command batmmath.pow(x:flt,y:bat[:flt]):bat[:flt] 
+address CMDscience_cst_bat_pow_flt;
+command batmmath.pow(x:dbl,y:bat[:dbl]):bat[:dbl] 
+address CMDscience_cst_bat_pow_dbl;
 command batmmath.pow(x:bat[:flt],y:flt):bat[:flt] 
 address CMDscience_bat_cst_pow_flt;
 command batmmath.pow(x:bat[:dbl],y:dbl):bat[:dbl] 
@@ -40205,6 +40213,10 @@ command bbp.getIndex(b:bat[:any_2]):int
 address CMDbbpgetIndex;
 comment Retrieve the index in the BBP
 
+command bbp.setName(b:bat[:any_1],n:str):str 
+address CMDsetName;
+comment Rename a BAT
+
 command blob.blob(s:str):blob 
 address BLOBblob_fromstr;
 command blob.blob(s:blob):blob 
@@ -51289,6 +51301,11 @@ pattern sql.argRecord():str
 address SQLargRecord;
 comment Glue together the calling sequence
 
+inline function 
sql.all(b:bat[:any_1],gp:bat[:oid],gpe:bat[:oid],no_nil:bit):bat[:any_1];
+command sql.all(col:bat[:any_1]):any_1 
+address SQLall;
+comment if col contains exactly one value return this. Incase of more raise an 
exception else return nil
+
 pattern sql.affectedRows(mvc:int,nr:wrd):int 
 address mvc_affected_rows_wrap;
 comment export the number of affected rows by the current query
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,16 +62,59 @@ 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;
+'''
+# generate a monster query to get all functions with all their
+# arguments on a single row of a table
+
+# maximum number of arguments used in any standard function (also
+# determines the number of joins in the query and the number of
+# columns in the result):
+MAXARGS = 16
+# columns of the args table we're interested in
+args = ['name', 'type', 'type_digits', 'type_scale', 'inout']
+
+out += "with\n"
+for i in range(1, MAXARGS + 1):
+    out += "arg%d (id" % i
+    for j in range(1, i + 1):
+        for k in ['id'] + args:
+            out += ", %s%d" % (k, j)
+    out += ") as (select "
+    if i == 1:
+        out += "f.id"
+        for k in ['id'] + args:
+            out += ", a%d.%s" % (i, k)
+        out += " from sys.functions f left outer join args a%d on a%d.func_id 
= f.id" % (i, i)
+    else:
+        out += "arg%d.*" % (i - 1)
+        for k in ['id'] + args:
+            out += ", a%d.%s" % (i, k)
+        out += " from arg%d left outer join args a%d on a%d.func_id = 
arg%d.id" % (i - 1, i, i, i - 1)
+    out += " and a%d.number = %d)" % (i, i)
+    if i < MAXARGS:
+        out += ","
+    out += "\n"
+out += "select s.name, f.name"
+for i in range(1, MAXARGS):
+    for k in args:
+        out += ", arg%d.%s%d" % (MAXARGS, k, i)
+out += " from arg%d, sys.schemas s, sys.functions f where s.id = f.schema_id 
and f.id = arg%d.id order by s.name, f.name" % (MAXARGS, MAXARGS)
+for i in range(1, MAXARGS):
+    for k in args:
+        out += ", arg%d.%s%d" % (MAXARGS, k, i)
+out += ";"
+out += '''
 -- auths
 select name, grantor from sys.auths;
 -- connections (expect empty)
@@ -79,7 +122,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, dt.name from (values (1, 
'SCHEMA_DEPENDENCY'), (2, 'TABLE_DEPENDENCY'), (3, 'COLUMN_DEPENDENCY'), (4, 
'KEY_DEPENDENCY'), (5, 'VIEW_DEPENDENCY'), (6, 'USER_DEPENDENCY'), (7, 
'FUNC_DEPENDENCY'), (8, 'TRIGGER_DEPENDENCY'), (9, 'OWNER_DEPENDENCY'), (10, 
'INDEX_DEPENDENCY'), (11, 'FKEY_DEPENDENCY'), (12, 'SEQ_DEPENDENCY'), (13, 
'PROC_DEPENDENCY'), (14, 'BEDROPPED_DEPENDENCY'), (15, 'TYPE_DEPENDENCY')) as 
dt (id, name), sys.dependencies d, sys.functions f1, sys.functions f2, 
sys.schemas s1, sys.schemas s2 where d.depend_type = dt.id and 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, dt.name from (values (1, 
'SCHEMA_DEPENDENCY'), (2, 'TABLE_DEPENDENCY'), (3, 'COLUMN_DEPENDENCY'), (4, 
'KEY_DEPENDENCY'), (5, 'VIEW_DEPENDENCY'), (6, 'USER_DEPENDENCY'), (7, 
'FUNC_DEPENDENCY'), (8, 'TRIGGER_DEPENDENCY'), (9, 'OWNER_DEPENDENCY'), (10, 
'INDEX_DEPENDENCY'), (11, 'FKEY_DEPENDENCY'), (12, 'SEQ_DEPENDENCY'), (13, 
'PROC_DEPENDENCY'), (14, 'BEDROPPED_DEPENDENCY'), (15, 'TYPE_DEPENDENCY')) as 
dt (id, name), sys.dependencies d, sys._tables t, sys.schemas s1, sys.functions 
f, sys.schemas s2 where d.depend_type = dt.id and 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, dt.name from (values (1, 
'SCHEMA_DEPENDENCY'), (2, 'TABLE_DEPENDENCY'), (3, 'COLUMN_DEPENDENCY'), (4, 
'KEY_DEPENDENCY'), (5, 'VIEW_DEPENDENCY'), (6, 'USER_DEPENDENCY'), (7, 
'FUNC_DEPENDENCY'), (8, 'TRIGGER_DEPENDENCY'), (9, 'OWNER_DEPENDENCY'), (10, 
'INDEX_DEPENDENCY'), (11, 'FKEY_DEPENDENCY'), (12, 'SEQ_DEPENDENCY'), (13, 
'PROC_DEPENDENCY'), (14, 'BEDROPPED_DEPENDENCY'), (15, 'TYPE_DEPENDENCY')) as 
dt (id, name), sys.dependencies d, sys._columns c, sys._tables t, sys.schemas 
s1, sys.functions f, sys.schemas s2 where d.depend_type = dt.id and 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, dt.name from (values (1, 
'SCHEMA_DEPENDENCY'), (2, 'TABLE_DEPENDENCY'), (3, 'COLUMN_DEPENDENCY'), (4, 
'KEY_DEPENDENCY'), (5, 'VIEW_DEPENDENCY'), (6, 'USER_DEPENDENCY'), (7, 
'FUNC_DEPENDENCY'), (8, 'TRIGGER_DEPENDENCY'), (9, 'OWNER_DEPENDENCY'), (10, 
'INDEX_DEPENDENCY'), (11, 'FKEY_DEPENDENCY'), (12, 'SEQ_DEPENDENCY'), (13, 
'PROC_DEPENDENCY'), (14, 'BEDROPPED_DEPENDENCY'), (15, 'TYPE_DEPENDENCY')) as 
dt (id, name), schemas s1, functions f1, schemas s2, _tables t2, dependencies d 
where d.depend_type = dt.id and 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, dt.name from (values (1, 
'SCHEMA_DEPENDENCY'), (2, 'TABLE_DEPENDENCY'), (3, 'COLUMN_DEPENDENCY'), (4, 
'KEY_DEPENDENCY'), (5, 'VIEW_DEPENDENCY'), (6, 'USER_DEPENDENCY'), (7, 
'FUNC_DEPENDENCY'), (8, 'TRIGGER_DEPENDENCY'), (9, 'OWNER_DEPENDENCY'), (10, 
'INDEX_DEPENDENCY'), (11, 'FKEY_DEPENDENCY'), (12, 'SEQ_DEPENDENCY'), (13, 
'PROC_DEPENDENCY'), (14, 'BEDROPPED_DEPENDENCY'), (15, 'TYPE_DEPENDENCY')) as 
dt (id, name), schemas s1, _tables t1, schemas s2, _tables t2, dependencies d 
where d.depend_type = dt.id and 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, dt.name from (values (1, 
'SCHEMA_DEPENDENCY'), (2, 'TABLE_DEPENDENCY'), (3, 'COLUMN_DEPENDENCY'), (4, 
'KEY_DEPENDENCY'), (5, 'VIEW_DEPENDENCY'), (6, 'USER_DEPENDENCY'), (7, 
'FUNC_DEPENDENCY'), (8, 'TRIGGER_DEPENDENCY'), (9, 'OWNER_DEPENDENCY'), (10, 
'INDEX_DEPENDENCY'), (11, 'FKEY_DEPENDENCY'), (12, 'SEQ_DEPENDENCY'), (13, 
'PROC_DEPENDENCY'), (14, 'BEDROPPED_DEPENDENCY'), (15, 'TYPE_DEPENDENCY')) as 
dt (id, name), schemas s1, _tables t1, _columns c1, schemas s2, _tables t2, 
dependencies d where d.depend_type = dt.id and 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, dt.name from 
(values (1, 'SCHEMA_DEPENDENCY'), (2, 'TABLE_DEPENDENCY'), (3, 
'COLUMN_DEPENDENCY'), (4, 'KEY_DEPENDENCY'), (5, 'VIEW_DEPENDENCY'), (6, 
'USER_DEPENDENCY'), (7, 'FUNC_DEPENDENCY'), (8, 'TRIGGER_DEPENDENCY'), (9, 
'OWNER_DEPENDENCY'), (10, 'INDEX_DEPENDENCY'), (11, 'FKEY_DEPENDENCY'), (12, 
'SEQ_DEPENDENCY'), (13, 'PROC_DEPENDENCY'), (14, 'BEDROPPED_DEPENDENCY'), (15, 
'TYPE_DEPENDENCY')) as dt (id, name), dependencies d, _tables t1, _tables t2, 
schemas s1, schemas s2, _columns c1, keys k2 where d.depend_type = dt.id and 
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, dt.name from 
(values (1, 'SCHEMA_DEPENDENCY'), (2, 'TABLE_DEPENDENCY'), (3, 
'COLUMN_DEPENDENCY'), (4, 'KEY_DEPENDENCY'), (5, 'VIEW_DEPENDENCY'), (6, 
'USER_DEPENDENCY'), (7, 'FUNC_DEPENDENCY'), (8, 'TRIGGER_DEPENDENCY'), (9, 
'OWNER_DEPENDENCY'), (10, 'INDEX_DEPENDENCY'), (11, 'FKEY_DEPENDENCY'), (12, 
'SEQ_DEPENDENCY'), (13, 'PROC_DEPENDENCY'), (14, 'BEDROPPED_DEPENDENCY'), (15, 
'TYPE_DEPENDENCY')) as dt (id, name), dependencies d, _tables t1, _tables t2, 
schemas s1, schemas s2, _columns c1, idxs i2 where d.depend_type = dt.id and 
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, dt.name from (values (1, 
'SCHEMA_DEPENDENCY'), (2, 'TABLE_DEPENDENCY'), (3, 'COLUMN_DEPENDENCY'), (4, 
'KEY_DEPENDENCY'), (5, 'VIEW_DEPENDENCY'), (6, 'USER_DEPENDENCY'), (7, 
'FUNC_DEPENDENCY'), (8, 'TRIGGER_DEPENDENCY'), (9, 'OWNER_DEPENDENCY'), (10, 
'INDEX_DEPENDENCY'), (11, 'FKEY_DEPENDENCY'), (12, 'SEQ_DEPENDENCY'), (13, 
'PROC_DEPENDENCY'), (14, 'BEDROPPED_DEPENDENCY'), (15, 'TYPE_DEPENDENCY')) as 
dt (id, name), types t, functions f, schemas s, dependencies d where 
d.depend_type = dt.id and 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
@@ -87,6 +138,8 @@ with x as (select k.id as id, t.name as 
 -- objects
 select name, nr from sys.objects order by name, nr;
 -- privileges
+--  schemas
+select s.name, u.name from sys.schemas s, sys.users u where s.id = 
u.default_schema order by s.name, u.name;
 --  tables
 select t.name, a.name, p.privileges, g.name, p.grantable from sys._tables t, 
sys.privileges p left outer join sys.auths g on p.grantor = g.id, sys.auths a 
where t.id = p.obj_id and p.auth_id = a.id order by t.name, a.name;
 --  columns
@@ -107,6 +160,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
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to