Changeset: c1e58a52249a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c1e58a52249a
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/SQL-dump.stable.out
        clients/Tests/SQL-dump.stable.out.int128
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql.mal
        sql/backends/monet5/sql_result.c
        sql/backends/monet5/sql_upgrades.c
        sql/scripts/75_storagemodel.sql
        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/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/check.stable.out.int128
        sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128
        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/check.stable.out
        sql/test/emptydb/Tests/check.stable.out.int128
        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/drop3.stable.out
        sql/test/leaks/Tests/drop3.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/leaks/Tests/temp1.stable.out
        sql/test/leaks/Tests/temp1.stable.out.int128
        sql/test/leaks/Tests/temp2.stable.out
        sql/test/leaks/Tests/temp2.stable.out.int128
        sql/test/leaks/Tests/temp3.stable.out
        sql/test/leaks/Tests/temp3.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.32bit
        sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128
Branch: default
Log Message:

Update sys.storage() to also return revsorted and unique columns.
These two new columns and the already existing sorted column now have
a value TRUE if the property is know to be set, FALSE if it is known
to be unset, and NULL if nothing is known about the property.

Note that the SQL catalog was changed.  Updates are only available for
databases created with the Jun2016 (or older) releases.


diffs (truncated from 4067 to 300 lines):

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
@@ -60,7 +60,7 @@ Ready.
 % .,   .,      .,      .,      . # table_name
 % module,      function,       signature,      address,        comment # name
 % clob,        clob,   clob,   clob,   clob # type
-% 11,  28,     312,    44,     874 # length
+% 11,  28,     346,    44,     874 # length
 [ "aggr",      "avg",  "command 
aggr.avg(b:bat[:bte],g:bat[:oid],e:bat[:any_1]):bat[:dbl] ",   
"AGGRavg13_dbl;",       "Grouped tail average on bte"   ]
 [ "aggr",      "avg",  "command 
aggr.avg(b:bat[:dbl],g:bat[:oid],e:bat[:any_1]):bat[:dbl] ",   
"AGGRavg13_dbl;",       "Grouped tail average on dbl"   ]
 [ "aggr",      "avg",  "command 
aggr.avg(b:bat[:flt],g:bat[:oid],e:bat[:any_1]):bat[:dbl] ",   
"AGGRavg13_dbl;",       "Grouped tail average on flt"   ]
@@ -8450,10 +8450,10 @@ Ready.
 [ "sql",       "sql_variables",        "pattern sql.sql_variables():bat[:str] 
",       "sql_variables;",       "return the table with session variables"      
 ]
 [ "sql",       "start",        "pattern sql.start():void ",    "SQLsession;",  
"Switch to processing SQL statements"   ]
 [ "sql",       "start2",       "pattern sql.start2():void ",   "SQLsession2;", 
"Switch to processing precompiled sql statements"       ]
-[ "sql",       "storage",      "pattern sql.storage() 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],orderidx:bat[:lng])
 ",  "sql_storage;", "return a table with storage information "      ]
-[ "sql",       "storage",      "pattern sql.storage(sname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],orderidx:bat[:lng])
 ", "sql_storage;", "return a table with storage information for a particular 
schema "      ]
-[ "sql",       "storage",      "pattern sql.storage(sname:str,tname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],orderidx:bat[:lng])
 ",       "sql_storage;", "return a table with storage information for a 
particular table"        ]
-[ "sql",       "storage",      "pattern 
sql.storage(sname:str,tname:str,cname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],orderidx:bat[:lng])
 ",     "sql_storage;", "return a table with storage information for a 
particular column"       ]
+[ "sql",       "storage",      "pattern sql.storage() 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],revsorted:bat[:bit],key:bat[:bit],orderidx:bat[:lng])
 ",        "sql_storage;", "return a table with storage information "      ]
+[ "sql",       "storage",      "pattern sql.storage(sname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],revsorted:bat[:bit],key:bat[:bit],orderidx:bat[:lng])
 ",       "sql_storage;", "return a table with storage information for a 
particular schema "      ]
+[ "sql",       "storage",      "pattern sql.storage(sname:str,tname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],revsorted:bat[:bit],key:bat[:bit],orderidx:bat[:lng])
 ",     "sql_storage;", "return a table with storage information for a 
particular table"        ]
+[ "sql",       "storage",      "pattern 
sql.storage(sname:str,tname:str,cname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],revsorted:bat[:bit],key:bat[:bit],orderidx:bat[:lng])
 ",   "sql_storage;", "return a table with storage information for a particular 
column"       ]
 [ "sql",       "subdelta",     "command 
sql.subdelta(col:bat[:oid],cand:bat[:oid],uid:bat[:oid],uval:bat[:oid]):bat[:oid]
 ",   "DELTAsub2;",   "Return a single bat of subselected delta."     ]
 [ "sql",       "subdelta",     "command 
sql.subdelta(col:bat[:oid],cand:bat[:oid],uid:bat[:oid],uval:bat[:oid],ins:bat[:oid]):bat[:oid]
 ",     "DELTAsub;",    "Return a single bat of subselected delta."     ]
 [ "sql",       "subzero_or_one",       "inline function 
sql.subzero_or_one(b:bat[:any_1],gp:bat[:oid],gpe:bat[:oid],no_nil:bit):bat[:any_1];",
 "",     ""      ]
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
@@ -64,7 +64,7 @@ Ready.
 % .,   .,      .,      .,      . # table_name
 % module,      function,       signature,      address,        comment # name
 % clob,        clob,   clob,   clob,   clob # type
-% 11,  28,     312,    44,     874 # length
+% 11,  28,     346,    44,     874 # length
 [ "aggr",      "avg",  "command 
aggr.avg(b:bat[:bte],g:bat[:oid],e:bat[:any_1]):bat[:dbl] ",   
"AGGRavg13_dbl;",       "Grouped tail average on bte"   ]
 [ "aggr",      "avg",  "command 
aggr.avg(b:bat[:dbl],g:bat[:oid],e:bat[:any_1]):bat[:dbl] ",   
"AGGRavg13_dbl;",       "Grouped tail average on dbl"   ]
 [ "aggr",      "avg",  "command 
aggr.avg(b:bat[:flt],g:bat[:oid],e:bat[:any_1]):bat[:dbl] ",   
"AGGRavg13_dbl;",       "Grouped tail average on flt"   ]
@@ -10819,10 +10819,10 @@ Ready.
 [ "sql",       "sql_variables",        "pattern sql.sql_variables():bat[:str] 
",       "sql_variables;",       "return the table with session variables"      
 ]
 [ "sql",       "start",        "pattern sql.start():void ",    "SQLsession;",  
"Switch to processing SQL statements"   ]
 [ "sql",       "start2",       "pattern sql.start2():void ",   "SQLsession2;", 
"Switch to processing precompiled sql statements"       ]
-[ "sql",       "storage",      "pattern sql.storage() 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],orderidx:bat[:lng])
 ",  "sql_storage;", "return a table with storage information "      ]
-[ "sql",       "storage",      "pattern sql.storage(sname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],orderidx:bat[:lng])
 ", "sql_storage;", "return a table with storage information for a particular 
schema "      ]
-[ "sql",       "storage",      "pattern sql.storage(sname:str,tname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],orderidx:bat[:lng])
 ",       "sql_storage;", "return a table with storage information for a 
particular table"        ]
-[ "sql",       "storage",      "pattern 
sql.storage(sname:str,tname:str,cname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],orderidx:bat[:lng])
 ",     "sql_storage;", "return a table with storage information for a 
particular column"       ]
+[ "sql",       "storage",      "pattern sql.storage() 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],revsorted:bat[:bit],key:bat[:bit],orderidx:bat[:lng])
 ",        "sql_storage;", "return a table with storage information "      ]
+[ "sql",       "storage",      "pattern sql.storage(sname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],revsorted:bat[:bit],key:bat[:bit],orderidx:bat[:lng])
 ",       "sql_storage;", "return a table with storage information for a 
particular schema "      ]
+[ "sql",       "storage",      "pattern sql.storage(sname:str,tname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],revsorted:bat[:bit],key:bat[:bit],orderidx:bat[:lng])
 ",     "sql_storage;", "return a table with storage information for a 
particular table"        ]
+[ "sql",       "storage",      "pattern 
sql.storage(sname:str,tname:str,cname:str) 
(schema:bat[:str],table:bat[:str],column:bat[:str],type:bat[:str],mode:bat[:str],location:bat[:str],count:bat[:lng],atomwidth:bat[:int],columnsize:bat[:lng],heap:bat[:lng],hashes:bat[:lng],phash:bat[:bit],imprints:bat[:lng],sorted:bat[:bit],revsorted:bat[:bit],key:bat[:bit],orderidx:bat[:lng])
 ",   "sql_storage;", "return a table with storage information for a particular 
column"       ]
 [ "sql",       "subdelta",     "command 
sql.subdelta(col:bat[:oid],cand:bat[:oid],uid:bat[:oid],uval:bat[:oid]):bat[:oid]
 ",   "DELTAsub2;",   "Return a single bat of subselected delta."     ]
 [ "sql",       "subdelta",     "command 
sql.subdelta(col:bat[:oid],cand:bat[:oid],uid:bat[:oid],uval:bat[:oid],ins:bat[:oid]):bat[:oid]
 ",     "DELTAsub;",    "Return a single bat of subselected delta."     ]
 [ "sql",       "subzero_or_one",       "inline function 
sql.subzero_or_one(b:bat[:any_1],gp:bat[:oid],gpe:bat[:oid],no_nil:bit):bat[:any_1];",
 "",     ""      ]
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
@@ -821,7 +821,7 @@ CREATE TABLE "sys"."schemas" ("id" INTEG
 CREATE TABLE "sys"."sequences" ("id" INTEGER, "schema_id" INTEGER, "name" 
VARCHAR(256), "start" BIGINT, "minvalue" BIGINT, "maxvalue" BIGINT, "increment" 
BIGINT, "cacheinc" BIGINT, "cycle" BOOLEAN);
 CREATE TABLE "sys"."spatial_ref_sys" ("srid" INTEGER NOT NULL, "auth_name" 
VARCHAR(256), "auth_srid" INTEGER, "srtext" VARCHAR(2048), "proj4text" 
VARCHAR(2048), CONSTRAINT "spatial_ref_sys_srid_pkey" PRIMARY KEY ("srid"));
 CREATE TABLE "sys"."statistics" ("column_id" INTEGER, "type" CHARACTER LARGE 
OBJECT, "width" INTEGER, "stamp" TIMESTAMP, "sample" BIGINT, "count" BIGINT, 
"unique" BIGINT, "nils" BIGINT, "minval" CHARACTER LARGE OBJECT, "maxval" 
CHARACTER LARGE OBJECT, "sorted" BOOLEAN);
-CREATE TABLE "sys"."storagemodelinput" ("schema" CHARACTER LARGE OBJECT, 
"table" CHARACTER LARGE OBJECT, "column" CHARACTER LARGE OBJECT, "type" 
CHARACTER LARGE OBJECT, "typewidth" INTEGER, "count" BIGINT, "distinct" BIGINT, 
"atomwidth" INTEGER, "reference" BOOLEAN, "sorted" BOOLEAN, "orderidx" BIGINT);
+CREATE TABLE "sys"."storagemodelinput" ("schema" CHARACTER LARGE OBJECT, 
"table" CHARACTER LARGE OBJECT, "column" CHARACTER LARGE OBJECT, "type" 
CHARACTER LARGE OBJECT, "typewidth" INTEGER, "count" BIGINT, "distinct" BIGINT, 
"atomwidth" INTEGER, "reference" BOOLEAN, "sorted" BOOLEAN, "revsorted" 
BOOLEAN, "unique" BOOLEAN, "orderidx" BIGINT);
 CREATE TABLE "sys"."systemfunctions" ("function_id" INTEGER);
 CREATE TABLE "sys"."table_types" ("table_type_id" SMALLINT NOT NULL, 
"table_type_name" VARCHAR(25) NOT NULL, CONSTRAINT 
"table_types_table_type_id_pkey" PRIMARY KEY ("table_type_id"), CONSTRAINT 
"table_types_table_type_name_unique" UNIQUE ("table_type_name"));
 CREATE TABLE "sys"."triggers" ("id" INTEGER, "name" VARCHAR(1024), "table_id" 
INTEGER, "time" SMALLINT, "orientation" SMALLINT, "event" SMALLINT, "old_name" 
VARCHAR(1024), "new_name" VARCHAR(1024), "condition" VARCHAR(2048), "statement" 
VARCHAR(2048));
@@ -1155,12 +1155,12 @@ create aggregate stddev_samp(val time) r
 create aggregate stddev_samp(val timestamp) returns double external name 
"aggr"."stdev";
 create procedure sys.stop(tag int) external name sql.sysmon_stop;
 create procedure sys.stop(tag bigint) external name sql.sysmon_stop;
-create function sys."storage"() returns table ("schema" string, "table" 
string, "column" string, "type" string, "mode" string, location string, "count" 
bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, "imprints" bigint, sorted boolean, orderidx bigint) external name 
sql."storage";
-create function sys."storage"(sname string) returns table ("schema" string, 
"table" string, "column" string, "type" string, "mode" string, location string, 
"count" bigint, typewidth int, columnsize bigint, heapsize bigint, hashes 
bigint, phash boolean, "imprints" bigint, sorted boolean, orderidx bigint) 
external name sql."storage";
-create function sys."storage"(sname string, tname string) returns table 
("schema" string, "table" string, "column" string, "type" string, "mode" 
string, location string, "count" bigint, typewidth int, columnsize bigint, 
heapsize bigint, hashes bigint, phash boolean, "imprints" bigint, sorted 
boolean, orderidx bigint) external name sql."storage";
-create function sys."storage"(sname string, tname string, cname string) 
returns table ("schema" string, "table" string, "column" string, "type" string, 
"mode" string, location string, "count" bigint, typewidth int, columnsize 
bigint, heapsize bigint, hashes bigint, phash boolean, "imprints" bigint, 
sorted boolean, orderidx bigint) external name sql."storage";
-create function sys.storagemodel() returns table ("schema" string, "table" 
string, "column" string, "type" string, "count" bigint, columnsize bigint, 
heapsize bigint, hashes bigint, "imprints" bigint, sorted boolean, orderidx 
bigint) begin return select i."schema", i."table", i."column", i."type", 
i."count", columnsize(i."type", i.count, i."distinct"), heapsize(i."type", 
i."distinct", i."atomwidth"), hashsize(i."reference", i."count"), 
imprintsize(i."count",i."type"), i.sorted, i.orderidx from 
sys.storagemodelinput i; end;
-create procedure sys.storagemodelinit() begin delete from 
sys.storagemodelinput; insert into sys.storagemodelinput select x."schema", 
x."table", x."column", x."type", x.typewidth, x.count, 0, x.typewidth, false, 
x.sorted, x.orderidx from sys."storage"() x; update sys.storagemodelinput set 
reference = true where concat(concat("schema","table"), "column") in (select 
concat(concat("fkschema"."name", "fktable"."name"), "fkkeycol"."name") from 
"sys"."keys" as "fkkey", "sys"."objects" as "fkkeycol", "sys"."tables" as 
"fktable", "sys"."schemas" as "fkschema" where "fktable"."id" = 
"fkkey"."table_id" and "fkkey"."id" = "fkkeycol"."id" and "fkschema"."id" = 
"fktable"."schema_id" and "fkkey"."rkey" > -1); update sys.storagemodelinput 
set "distinct" = "count" where "type" = 'varchar' or "type"='clob'; end;
+create function sys."storage"() returns table ("schema" string, "table" 
string, "column" string, "type" string, "mode" string, location string, "count" 
bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, "imprints" bigint, sorted boolean, revsorted boolean, "unique" 
boolean, orderidx bigint) external name sql."storage";
+create function sys."storage"(sname string) returns table ("schema" string, 
"table" string, "column" string, "type" string, "mode" string, location string, 
"count" bigint, typewidth int, columnsize bigint, heapsize bigint, hashes 
bigint, phash boolean, "imprints" bigint, sorted boolean, revsorted boolean, 
"unique" boolean, orderidx bigint) external name sql."storage";
+create function sys."storage"(sname string, tname string) returns table 
("schema" string, "table" string, "column" string, "type" string, "mode" 
string, location string, "count" bigint, typewidth int, columnsize bigint, 
heapsize bigint, hashes bigint, phash boolean, "imprints" bigint, sorted 
boolean, revsorted boolean, "unique" boolean, orderidx bigint) external name 
sql."storage";
+create function sys."storage"(sname string, tname string, cname string) 
returns table ("schema" string, "table" string, "column" string, "type" string, 
"mode" string, location string, "count" bigint, typewidth int, columnsize 
bigint, heapsize bigint, hashes bigint, phash boolean, "imprints" bigint, 
sorted boolean, revsorted boolean, "unique" boolean, orderidx bigint) external 
name sql."storage";
+create function sys.storagemodel() returns table ("schema" string, "table" 
string, "column" string, "type" string, "count" bigint, columnsize bigint, 
heapsize bigint, hashes bigint, "imprints" bigint, sorted boolean, revsorted 
boolean, "unique" boolean, orderidx bigint) begin return select i."schema", 
i."table", i."column", i."type", i."count", columnsize(i."type", i.count, 
i."distinct"), heapsize(i."type", i."distinct", i."atomwidth"), 
hashsize(i."reference", i."count"), imprintsize(i."count",i."type"), i.sorted, 
i.revsorted, i."unique", i.orderidx from sys.storagemodelinput i; end;
+create procedure sys.storagemodelinit() begin delete from 
sys.storagemodelinput; insert into sys.storagemodelinput select x."schema", 
x."table", x."column", x."type", x.typewidth, x.count, 0, x.typewidth, false, 
x.sorted, x.revsorted, x."unique", x.orderidx from sys."storage"() x; update 
sys.storagemodelinput set reference = true where 
concat(concat("schema","table"), "column") in (select 
concat(concat("fkschema"."name", "fktable"."name"), "fkkeycol"."name") from 
"sys"."keys" as "fkkey", "sys"."objects" as "fkkeycol", "sys"."tables" as 
"fktable", "sys"."schemas" as "fkschema" where "fktable"."id" = 
"fkkey"."table_id" and "fkkey"."id" = "fkkeycol"."id" and "fkschema"."id" = 
"fktable"."schema_id" and "fkkey"."rkey" > -1); update sys.storagemodelinput 
set "distinct" = "count" where "type" = 'varchar' or "type"='clob'; end;
 create function str_to_date(s string, format string) returns date external 
name mtime."str_to_date";
 create function str_to_time(s string, format string) returns time external 
name mtime."str_to_time";
 create function str_to_timestamp(s string, format string) returns timestamp 
external name mtime."str_to_timestamp";
@@ -1646,7 +1646,9 @@ drop function pcre_replace(string, strin
 [ "storage",   "phash",        "boolean",      1,      0,      NULL,   true,   
11,     NULL    ]
 [ "storage",   "imprints",     "bigint",       64,     0,      NULL,   true,   
12,     NULL    ]
 [ "storage",   "sorted",       "boolean",      1,      0,      NULL,   true,   
13,     NULL    ]
-[ "storage",   "orderidx",     "bigint",       64,     0,      NULL,   true,   
14,     NULL    ]
+[ "storage",   "revsorted",    "boolean",      1,      0,      NULL,   true,   
14,     NULL    ]
+[ "storage",   "unique",       "boolean",      1,      0,      NULL,   true,   
15,     NULL    ]
+[ "storage",   "orderidx",     "bigint",       64,     0,      NULL,   true,   
16,     NULL    ]
 [ "storagemodel",      "schema",       "clob", 0,      0,      NULL,   true,   
0,      NULL    ]
 [ "storagemodel",      "table",        "clob", 0,      0,      NULL,   true,   
1,      NULL    ]
 [ "storagemodel",      "column",       "clob", 0,      0,      NULL,   true,   
2,      NULL    ]
@@ -1657,7 +1659,9 @@ drop function pcre_replace(string, strin
 [ "storagemodel",      "hashes",       "bigint",       64,     0,      NULL,   
true,   7,      NULL    ]
 [ "storagemodel",      "imprints",     "bigint",       64,     0,      NULL,   
true,   8,      NULL    ]
 [ "storagemodel",      "sorted",       "boolean",      1,      0,      NULL,   
true,   9,      NULL    ]
-[ "storagemodel",      "orderidx",     "bigint",       64,     0,      NULL,   
true,   10,     NULL    ]
+[ "storagemodel",      "revsorted",    "boolean",      1,      0,      NULL,   
true,   10,     NULL    ]
+[ "storagemodel",      "unique",       "boolean",      1,      0,      NULL,   
true,   11,     NULL    ]
+[ "storagemodel",      "orderidx",     "bigint",       64,     0,      NULL,   
true,   12,     NULL    ]
 [ "storagemodelinput", "schema",       "clob", 0,      0,      NULL,   true,   
0,      NULL    ]
 [ "storagemodelinput", "table",        "clob", 0,      0,      NULL,   true,   
1,      NULL    ]
 [ "storagemodelinput", "column",       "clob", 0,      0,      NULL,   true,   
2,      NULL    ]
@@ -1668,7 +1672,9 @@ drop function pcre_replace(string, strin
 [ "storagemodelinput", "atomwidth",    "int",  32,     0,      NULL,   true,   
7,      NULL    ]
 [ "storagemodelinput", "reference",    "boolean",      1,      0,      NULL,   
true,   8,      NULL    ]
 [ "storagemodelinput", "sorted",       "boolean",      1,      0,      NULL,   
true,   9,      NULL    ]
-[ "storagemodelinput", "orderidx",     "bigint",       64,     0,      NULL,   
true,   10,     NULL    ]
+[ "storagemodelinput", "revsorted",    "boolean",      1,      0,      NULL,   
true,   10,     NULL    ]
+[ "storagemodelinput", "unique",       "boolean",      1,      0,      NULL,   
true,   11,     NULL    ]
+[ "storagemodelinput", "orderidx",     "bigint",       64,     0,      NULL,   
true,   12,     NULL    ]
 [ "systemfunctions",   "function_id",  "int",  32,     0,      NULL,   true,   
0,      NULL    ]
 [ "table_types",       "table_type_id",        "smallint",     16,     0,      
NULL,   false,  0,      NULL    ]
 [ "table_types",       "table_type_name",      "varchar",      25,     0,      
NULL,   false,  1,      NULL    ]
@@ -1741,7 +1747,7 @@ drop function pcre_replace(string, strin
 % .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,     806,    9,      1,      1,      5,      5,      5 # length
+% 8,   35,     831,    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   ]
@@ -3197,12 +3203,12 @@ drop function pcre_replace(string, strin
 [ "sys",       "stddev_samp",  "create aggregate stddev_samp(val tinyint) 
returns double external name \"aggr\".\"stdev\";",   "aggr", 1,      3,      
false,  false,  false   ]
 [ "sys",       "stop", "create procedure sys.stop(tag bigint) external name 
sql.sysmon_stop;", "sql",  1,      2,      true,   false,  false   ]
 [ "sys",       "stop", "create procedure sys.stop(tag int) external name 
sql.sysmon_stop;",    "sql",  1,      2,      true,   false,  false   ]
-[ "sys",       "storage",      "create function sys.\"storage\"() returns 
table (\"schema\" string, \"table\" string, \"column\" string, \"type\" string, 
\"mode\" string, location string, \"count\" bigint, typewidth int, columnsize 
bigint, heapsize bigint, hashes bigint, phash boolean, \"imprints\" bigint, 
sorted boolean, orderidx bigint) external name sql.\"storage\";",  "sql",  1,   
   5,      false,  false,  false   ]
-[ "sys",       "storage",      "create function sys.\"storage\"(sname string) 
returns table (\"schema\" string, \"table\" string, \"column\" string, \"type\" 
string, \"mode\" string, location string, \"count\" bigint, typewidth int, 
columnsize bigint, heapsize bigint, hashes bigint, phash boolean, \"imprints\" 
bigint, sorted boolean, orderidx bigint) external name sql.\"storage\";",      
"sql",  1,      5,      false,  false,  false   ]
-[ "sys",       "storage",      "create function sys.\"storage\"(sname string, 
tname string) returns table (\"schema\" string, \"table\" string, \"column\" 
string, \"type\" string, \"mode\" string, location string, \"count\" bigint, 
typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, \"imprints\" bigint, sorted boolean, orderidx bigint) external name 
sql.\"storage\";",        "sql",  1,      5,      false,  false,  false   ]
-[ "sys",       "storage",      "create function sys.\"storage\"(sname string, 
tname string, cname string) returns table (\"schema\" string, \"table\" string, 
\"column\" string, \"type\" string, \"mode\" string, location string, \"count\" 
bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, \"imprints\" bigint, sorted boolean, orderidx bigint) external name 
sql.\"storage\";",  "sql",  1,      5,      false,  false,  false   ]
-[ "sys",       "storagemodel", "create function sys.storagemodel() returns 
table (\"schema\" string, \"table\" string, \"column\" string, \"type\" string, 
\"count\" bigint, columnsize bigint, heapsize bigint, hashes bigint, 
\"imprints\" bigint, sorted boolean, orderidx bigint) begin return select 
i.\"schema\", i.\"table\", i.\"column\", i.\"type\", i.\"count\", 
columnsize(i.\"type\", i.count, i.\"distinct\"), heapsize(i.\"type\", 
i.\"distinct\", i.\"atomwidth\"), hashsize(i.\"reference\", i.\"count\"), 
imprintsize(i.\"count\",i.\"type\"), i.sorted, i.orderidx from 
sys.storagemodelinput i; end;",     "user", 2,      5,      false,  false,  
false   ]
-[ "sys",       "storagemodelinit",     "create procedure 
sys.storagemodelinit() begin delete from sys.storagemodelinput; insert into 
sys.storagemodelinput select x.\"schema\", x.\"table\", x.\"column\", 
x.\"type\", x.typewidth, x.count, 0, x.typewidth, false, x.sorted, x.orderidx 
from sys.\"storage\"() x; update sys.storagemodelinput set reference = true 
where concat(concat(\"schema\",\"table\"), \"column\") in (select 
concat(concat(\"fkschema\".\"name\", \"fktable\".\"name\"), 
\"fkkeycol\".\"name\") from \"sys\".\"keys\" as \"fkkey\", \"sys\".\"objects\" 
as \"fkkeycol\", \"sys\".\"tables\" as \"fktable\", \"sys\".\"schemas\" as 
\"fkschema\" where \"fktable\".\"id\" = \"fkkey\".\"table_id\" and 
\"fkkey\".\"id\" = \"fkkeycol\".\"id\" and \"fkschema\".\"id\" = 
\"fktable\".\"schema_id\" and \"fkkey\".\"rkey\" > -1); update 
sys.storagemodelinput set \"distinct\" = \"count\" where \"type\" = 'varchar' 
or \"type\"='clob'; end;",       "user", 2,      2,      true,   false,  false  
 ]
+[ "sys",       "storage",      "create function sys.\"storage\"() returns 
table (\"schema\" string, \"table\" string, \"column\" string, \"type\" string, 
\"mode\" string, location string, \"count\" bigint, typewidth int, columnsize 
bigint, heapsize bigint, hashes bigint, phash boolean, \"imprints\" bigint, 
sorted boolean, revsorted boolean, \"unique\" boolean, orderidx bigint) 
external name sql.\"storage\";",   "sql",  1,      5,      false,  false,  
false   ]
+[ "sys",       "storage",      "create function sys.\"storage\"(sname string) 
returns table (\"schema\" string, \"table\" string, \"column\" string, \"type\" 
string, \"mode\" string, location string, \"count\" bigint, typewidth int, 
columnsize bigint, heapsize bigint, hashes bigint, phash boolean, \"imprints\" 
bigint, sorted boolean, revsorted boolean, \"unique\" boolean, orderidx bigint) 
external name sql.\"storage\";",       "sql",  1,      5,      false,  false,  
false   ]
+[ "sys",       "storage",      "create function sys.\"storage\"(sname string, 
tname string) returns table (\"schema\" string, \"table\" string, \"column\" 
string, \"type\" string, \"mode\" string, location string, \"count\" bigint, 
typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, \"imprints\" bigint, sorted boolean, revsorted boolean, \"unique\" 
boolean, orderidx bigint) external name sql.\"storage\";", "sql",  1,      5,   
   false,  false,  false   ]
+[ "sys",       "storage",      "create function sys.\"storage\"(sname string, 
tname string, cname string) returns table (\"schema\" string, \"table\" string, 
\"column\" string, \"type\" string, \"mode\" string, location string, \"count\" 
bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, \"imprints\" bigint, sorted boolean, revsorted boolean, \"unique\" 
boolean, orderidx bigint) external name sql.\"storage\";",   "sql",  1,      5, 
     false,  false,  false   ]
+[ "sys",       "storagemodel", "create function sys.storagemodel() returns 
table (\"schema\" string, \"table\" string, \"column\" string, \"type\" string, 
\"count\" bigint, columnsize bigint, heapsize bigint, hashes bigint, 
\"imprints\" bigint, sorted boolean, revsorted boolean, \"unique\" boolean, 
orderidx bigint) begin return select i.\"schema\", i.\"table\", i.\"column\", 
i.\"type\", i.\"count\", columnsize(i.\"type\", i.count, i.\"distinct\"), 
heapsize(i.\"type\", i.\"distinct\", i.\"atomwidth\"), 
hashsize(i.\"reference\", i.\"count\"), imprintsize(i.\"count\",i.\"type\"), 
i.sorted, i.revsorted, i.\"unique\", i.orderidx from sys.storagemodelinput i; 
end;",   "user", 2,      5,      false,  false,  false   ]
+[ "sys",       "storagemodelinit",     "create procedure 
sys.storagemodelinit() begin delete from sys.storagemodelinput; insert into 
sys.storagemodelinput select x.\"schema\", x.\"table\", x.\"column\", 
x.\"type\", x.typewidth, x.count, 0, x.typewidth, false, x.sorted, x.revsorted, 
x.\"unique\", x.orderidx from sys.\"storage\"() x; update sys.storagemodelinput 
set reference = true where concat(concat(\"schema\",\"table\"), \"column\") in 
(select concat(concat(\"fkschema\".\"name\", \"fktable\".\"name\"), 
\"fkkeycol\".\"name\") from \"sys\".\"keys\" as \"fkkey\", \"sys\".\"objects\" 
as \"fkkeycol\", \"sys\".\"tables\" as \"fktable\", \"sys\".\"schemas\" as 
\"fkschema\" where \"fktable\".\"id\" = \"fkkey\".\"table_id\" and 
\"fkkey\".\"id\" = \"fkkeycol\".\"id\" and \"fkschema\".\"id\" = 
\"fktable\".\"schema_id\" and \"fkkey\".\"rkey\" > -1); update 
sys.storagemodelinput set \"distinct\" = \"count\" where \"type\" = 'varchar' 
or \"type\"='clob'; end;",    "user", 2,      2,      true,   false,  false   ]
 [ "sys",       "str_to_date",  "create function str_to_date(s string, format 
string) returns date external name mtime.\"str_to_date\";",       "mtime",      
  1,      1,      false,  false,  false   ]
 [ "sys",       "str_to_time",  "create function str_to_time(s string, format 
string) returns time external name mtime.\"str_to_time\";",       "mtime",      
  1,      1,      false,  false,  false   ]
 [ "sys",       "str_to_timestamp",     "create function str_to_timestamp(s 
string, format string) returns timestamp external name 
mtime.\"str_to_timestamp\";",        "mtime",        1,      1,      false,  
false,  false   ]
@@ -3295,7 +3301,7 @@ drop function pcre_replace(string, strin
 % sys.s,       sys.f,  .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16 # table_name
 % name,        name,   name1,  type1,  type_digits1,   type_scale1,    inout1, 
name2,  type2,  type_digits2,   type_scale2,    inout2, name3,  type3,  
type_digits3,   type_scale3,    inout3, name4,  type4,  type_digits4,   
type_scale4,    inout4, name5,  type5,  type_digits5,   type_scale5,    inout5, 
name6,  type6,  type_digits6,   type_scale6,    inout6, name7,  type7,  
type_digits7,   type_scale7,    inout7, name8,  type8,  type_digits8,   
type_scale8,    inout8, name9,  type9,  type_digits9,   type_scale9,    inout9, 
name10, type10, type_digits10,  type_scale10,   inout10,        name11, type11, 
type_digits11,  type_scale11,   inout11,        name12, type12, type_digits12,  
type_scale12,   inout12,        name13, type13, type_digits13,  type_scale13,   
inout13,        name14, type14, type_digits14,  type_scale14,   inout14,        
name15, type15, type_digits15,  type_scale15,   inout15 # name
 % varchar,     varchar,        varchar,        varchar,        int,    int,    
tinyint,        varchar,        varchar,        int,    int,    tinyint,        
varchar,        varchar,        int,    int,    tinyint,        varchar,        
varchar,        int,    int,    tinyint,        varchar,        varchar,        
int,    int,    tinyint,        varchar,        varchar,        int,    int,    
tinyint,        varchar,        varchar,        int,    int,    tinyint,        
varchar,        varchar,        int,    int,    tinyint,        varchar,        
varchar,        int,    int,    tinyint,        varchar,        varchar,        
int,    int,    tinyint,        varchar,        varchar,        int,    int,    
tinyint,        varchar,        varchar,        int,    int,    tinyint,        
varchar,        varchar,        int,    int,    tinyint,        varchar,        
varchar,        int,    int,    tinyint,        varchar,        varchar,        
int,    int,    tinyint # type
-% 8,   35,     16,     14,     4,      1,      1,      16,     14,     2,      
1,      1,      27,     12,     2,      1,      1,      12,     7,      2,      
1,      1,      10,     7,      2,      1,      1,      8,      7,      2,      
1,      1,      9,      6,      2,      1,      1,      10,     6,      2,      
1,      1,      8,      7,      2,      1,      1,      8,      7,      2,      
1,      1,      5,      7,      2,      1,      1,      8,      6,      2,      
1,      1,      6,      7,      1,      1,      1,      8,      6,      2,      
1,      1,      5,      4,      1,      1,      1 # length
+% 8,   35,     16,     14,     4,      1,      1,      16,     14,     2,      
1,      1,      27,     12,     2,      1,      1,      12,     7,      2,      
1,      1,      10,     7,      2,      1,      1,      8,      7,      2,      
1,      1,      9,      6,      2,      1,      1,      10,     6,      2,      
1,      1,      8,      7,      2,      1,      1,      9,      7,      2,      
1,      1,      6,      7,      2,      1,      1,      8,      6,      2,      
1,      1,      6,      7,      1,      1,      1,      9,      7,      1,      
1,      1,      6,      7,      1,      1,      1 # length
 [ "bam",       "bam_drop_file",        "dbschema",     "smallint",     16,     
0,      1,      NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL    ]
 [ "bam",       "bam_export",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL    ]
 [ "bam",       "bam_flag",     "flag", "smallint",     16,     0,      1,      
"name", "clob", 0,      0,      1,      NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL    
]
@@ -4751,11 +4757,11 @@ drop function pcre_replace(string, strin
 [ "sys",       "stddev_samp",  "val",  "tinyint",      8,      0,      1,      
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL    
]
 [ "sys",       "stop", NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL    ]
 [ "sys",       "stop", NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL    ]
-[ "sys",       "storage",      "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "mode", "clob", 0,      0,      0,      "location",     "clob", 0,      
0,      0,      "count",        "bigint",       64,     0,      0,      
"typewidth",    "int",  32,     0,      0,      "columnsize",   "bigint",       
64,     0,      0,      "heapsize",     "bigint",       64,     0,      0,      
"hashes",       "bigint",       64,     0,      0,      "phash",        
"boolean",      1,      0,      0,      "imprints",     "bigint",       64,     
0,      0,      "sorted",       "boolean",      1,      0,      0,      
"orderidx",     "bigint",       64,     0,      0,      NULL,   NULL,   NULL,   
NULL,   NULL    ]
-[ "sys",       "storage",      "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "mode", "clob", 0,      0,      0,      "location",     "clob", 0,      
0,      0,      "count",        "bigint",       64,     0,      0,      
"typewidth",    "int",  32,     0,      0,      "columnsize",   "bigint",       
64,     0,      0,      "heapsize",     "bigint",       64,     0,      0,      
"hashes",       "bigint",       64,     0,      0,      "phash",        
"boolean",      1,      0,      0,      "imprints",     "bigint",       64,     
0,      0,      "sorted",       "boolean",      1,      0,      0,      
"orderidx",     "bigint",       64,     0,      0,      "sname",        "clob", 
0,      0,      1       ]
-[ "sys",       "storage",      "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "mode", "clob", 0,      0,      0,      "location",     "clob", 0,      
0,      0,      "count",        "bigint",       64,     0,      0,      
"typewidth",    "int",  32,     0,      0,      "columnsize",   "bigint",       
64,     0,      0,      "heapsize",     "bigint",       64,     0,      0,      
"hashes",       "bigint",       64,     0,      0,      "phash",        
"boolean",      1,      0,      0,      "imprints",     "bigint",       64,     
0,      0,      "sorted",       "boolean",      1,      0,      0,      
"orderidx",     "bigint",       64,     0,      0,      "sname",        "clob", 
0,      0,      1       ]
-[ "sys",       "storage",      "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "mode", "clob", 0,      0,      0,      "location",     "clob", 0,      
0,      0,      "count",        "bigint",       64,     0,      0,      
"typewidth",    "int",  32,     0,      0,      "columnsize",   "bigint",       
64,     0,      0,      "heapsize",     "bigint",       64,     0,      0,      
"hashes",       "bigint",       64,     0,      0,      "phash",        
"boolean",      1,      0,      0,      "imprints",     "bigint",       64,     
0,      0,      "sorted",       "boolean",      1,      0,      0,      
"orderidx",     "bigint",       64,     0,      0,      "sname",        "clob", 
0,      0,      1       ]
-[ "sys",       "storagemodel", "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "count",        "bigint",       64,     0,      0,      "columnsize",   
"bigint",       64,     0,      0,      "heapsize",     "bigint",       64,     
0,      0,      "hashes",       "bigint",       64,     0,      0,      
"imprints",     "bigint",       64,     0,      0,      "sorted",       
"boolean",      1,      0,      0,      "orderidx",     "bigint",       64,     
0,      0,      NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL    ]
+[ "sys",       "storage",      "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "mode", "clob", 0,      0,      0,      "location",     "clob", 0,      
0,      0,      "count",        "bigint",       64,     0,      0,      
"typewidth",    "int",  32,     0,      0,      "columnsize",   "bigint",       
64,     0,      0,      "heapsize",     "bigint",       64,     0,      0,      
"hashes",       "bigint",       64,     0,      0,      "phash",        
"boolean",      1,      0,      0,      "imprints",     "bigint",       64,     
0,      0,      "sorted",       "boolean",      1,      0,      0,      
"revsorted",    "boolean",      1,      0,      0,      "unique",       
"boolean",      1,      0,      0       ]
+[ "sys",       "storage",      "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "mode", "clob", 0,      0,      0,      "location",     "clob", 0,      
0,      0,      "count",        "bigint",       64,     0,      0,      
"typewidth",    "int",  32,     0,      0,      "columnsize",   "bigint",       
64,     0,      0,      "heapsize",     "bigint",       64,     0,      0,      
"hashes",       "bigint",       64,     0,      0,      "phash",        
"boolean",      1,      0,      0,      "imprints",     "bigint",       64,     
0,      0,      "sorted",       "boolean",      1,      0,      0,      
"revsorted",    "boolean",      1,      0,      0,      "unique",       
"boolean",      1,      0,      0       ]
+[ "sys",       "storage",      "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "mode", "clob", 0,      0,      0,      "location",     "clob", 0,      
0,      0,      "count",        "bigint",       64,     0,      0,      
"typewidth",    "int",  32,     0,      0,      "columnsize",   "bigint",       
64,     0,      0,      "heapsize",     "bigint",       64,     0,      0,      
"hashes",       "bigint",       64,     0,      0,      "phash",        
"boolean",      1,      0,      0,      "imprints",     "bigint",       64,     
0,      0,      "sorted",       "boolean",      1,      0,      0,      
"revsorted",    "boolean",      1,      0,      0,      "unique",       
"boolean",      1,      0,      0       ]
+[ "sys",       "storage",      "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "mode", "clob", 0,      0,      0,      "location",     "clob", 0,      
0,      0,      "count",        "bigint",       64,     0,      0,      
"typewidth",    "int",  32,     0,      0,      "columnsize",   "bigint",       
64,     0,      0,      "heapsize",     "bigint",       64,     0,      0,      
"hashes",       "bigint",       64,     0,      0,      "phash",        
"boolean",      1,      0,      0,      "imprints",     "bigint",       64,     
0,      0,      "sorted",       "boolean",      1,      0,      0,      
"revsorted",    "boolean",      1,      0,      0,      "unique",       
"boolean",      1,      0,      0       ]
+[ "sys",       "storagemodel", "table",        "clob", 0,      0,      0,      
"column",       "clob", 0,      0,      0,      "type", "clob", 0,      0,      
0,      "count",        "bigint",       64,     0,      0,      "columnsize",   
"bigint",       64,     0,      0,      "heapsize",     "bigint",       64,     
0,      0,      "hashes",       "bigint",       64,     0,      0,      
"imprints",     "bigint",       64,     0,      0,      "sorted",       
"boolean",      1,      0,      0,      "revsorted",    "boolean",      1,      
0,      0,      "unique",       "boolean",      1,      0,      0,      
"orderidx",     "bigint",       64,     0,      0,      NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL    ]
 [ "sys",       "storagemodelinit",     NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL    
]
 [ "sys",       "str_to_date",  "s",    "clob", 0,      0,      1,      
"format",       "clob", 0,      0,      1,      NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL    ]
 [ "sys",       "str_to_time",  "s",    "clob", 0,      0,      1,      
"format",       "clob", 0,      0,      1,      NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL    ]
@@ -5020,21 +5026,25 @@ drop function pcre_replace(string, strin
 [ "sys",       "storagemodelinput",    "distinct",     "sys",  "storagemodel", 
"FUNC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "orderidx",     "sys",  "storagemodel", 
"FUNC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "reference",    "sys",  "storagemodel", 
"FUNC_DEPENDENCY"       ]
+[ "sys",       "storagemodelinput",    "revsorted",    "sys",  "storagemodel", 
"FUNC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "schema",       "sys",  "storagemodel", 
"FUNC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "sorted",       "sys",  "storagemodel", 
"FUNC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "table",        "sys",  "storagemodel", 
"FUNC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "type", "sys",  "storagemodel", 
"FUNC_DEPENDENCY"       ]
+[ "sys",       "storagemodelinput",    "unique",       "sys",  "storagemodel", 
"FUNC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "atomwidth",    "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "column",       "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "count",        "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "distinct",     "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "orderidx",     "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "reference",    "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
+[ "sys",       "storagemodelinput",    "revsorted",    "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "schema",       "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "sorted",       "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "table",        "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "type", "sys",  "storagemodelinit",     
"PROC_DEPENDENCY"       ]
 [ "sys",       "storagemodelinput",    "typewidth",    "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
+[ "sys",       "storagemodelinput",    "unique",       "sys",  
"storagemodelinit",     "PROC_DEPENDENCY"       ]
 #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;
 % sys.s1,      sys.f1, sys.s2, sys.t2, .dt # table_name
 % name,        name,   name,   name,   name # name
diff --git a/clients/Tests/SQL-dump.stable.out.int128 
b/clients/Tests/SQL-dump.stable.out.int128
--- a/clients/Tests/SQL-dump.stable.out.int128
+++ b/clients/Tests/SQL-dump.stable.out.int128
@@ -817,7 +817,7 @@ CREATE TABLE "sys"."schemas" ("id" INTEG
 CREATE TABLE "sys"."sequences" ("id" INTEGER, "schema_id" INTEGER, "name" 
VARCHAR(256), "start" BIGINT, "minvalue" BIGINT, "maxvalue" BIGINT, "increment" 
BIGINT, "cacheinc" BIGINT, "cycle" BOOLEAN);
 CREATE TABLE "sys"."spatial_ref_sys" ("srid" INTEGER NOT NULL, "auth_name" 
VARCHAR(256), "auth_srid" INTEGER, "srtext" VARCHAR(2048), "proj4text" 
VARCHAR(2048), CONSTRAINT "spatial_ref_sys_srid_pkey" PRIMARY KEY ("srid"));
 CREATE TABLE "sys"."statistics" ("column_id" INTEGER, "type" CHARACTER LARGE 
OBJECT, "width" INTEGER, "stamp" TIMESTAMP, "sample" BIGINT, "count" BIGINT, 
"unique" BIGINT, "nils" BIGINT, "minval" CHARACTER LARGE OBJECT, "maxval" 
CHARACTER LARGE OBJECT, "sorted" BOOLEAN);
-CREATE TABLE "sys"."storagemodelinput" ("schema" CHARACTER LARGE OBJECT, 
"table" CHARACTER LARGE OBJECT, "column" CHARACTER LARGE OBJECT, "type" 
CHARACTER LARGE OBJECT, "typewidth" INTEGER, "count" BIGINT, "distinct" BIGINT, 
"atomwidth" INTEGER, "reference" BOOLEAN, "sorted" BOOLEAN, "orderidx" BIGINT);
+CREATE TABLE "sys"."storagemodelinput" ("schema" CHARACTER LARGE OBJECT, 
"table" CHARACTER LARGE OBJECT, "column" CHARACTER LARGE OBJECT, "type" 
CHARACTER LARGE OBJECT, "typewidth" INTEGER, "count" BIGINT, "distinct" BIGINT, 
"atomwidth" INTEGER, "reference" BOOLEAN, "sorted" BOOLEAN, "revsorted" 
BOOLEAN, "unique" BOOLEAN, "orderidx" BIGINT);
 CREATE TABLE "sys"."systemfunctions" ("function_id" INTEGER);
 CREATE TABLE "sys"."table_types" ("table_type_id" SMALLINT NOT NULL, 
"table_type_name" VARCHAR(25) NOT NULL, CONSTRAINT 
"table_types_table_type_id_pkey" PRIMARY KEY ("table_type_id"), CONSTRAINT 
"table_types_table_type_name_unique" UNIQUE ("table_type_name"));
 CREATE TABLE "sys"."triggers" ("id" INTEGER, "name" VARCHAR(1024), "table_id" 
INTEGER, "time" SMALLINT, "orientation" SMALLINT, "event" SMALLINT, "old_name" 
VARCHAR(1024), "new_name" VARCHAR(1024), "condition" VARCHAR(2048), "statement" 
VARCHAR(2048));
@@ -1159,12 +1159,12 @@ create aggregate stddev_samp(val timesta
 create aggregate stddev_samp(val hugeint) returns double external name 
"aggr"."stdev";
 create procedure sys.stop(tag int) external name sql.sysmon_stop;
 create procedure sys.stop(tag bigint) external name sql.sysmon_stop;
-create function sys."storage"() returns table ("schema" string, "table" 
string, "column" string, "type" string, "mode" string, location string, "count" 
bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, "imprints" bigint, sorted boolean, orderidx bigint) external name 
sql."storage";
-create function sys."storage"(sname string) returns table ("schema" string, 
"table" string, "column" string, "type" string, "mode" string, location string, 
"count" bigint, typewidth int, columnsize bigint, heapsize bigint, hashes 
bigint, phash boolean, "imprints" bigint, sorted boolean, orderidx bigint) 
external name sql."storage";
-create function sys."storage"(sname string, tname string) returns table 
("schema" string, "table" string, "column" string, "type" string, "mode" 
string, location string, "count" bigint, typewidth int, columnsize bigint, 
heapsize bigint, hashes bigint, phash boolean, "imprints" bigint, sorted 
boolean, orderidx bigint) external name sql."storage";
-create function sys."storage"(sname string, tname string, cname string) 
returns table ("schema" string, "table" string, "column" string, "type" string, 
"mode" string, location string, "count" bigint, typewidth int, columnsize 
bigint, heapsize bigint, hashes bigint, phash boolean, "imprints" bigint, 
sorted boolean, orderidx bigint) external name sql."storage";
-create function sys.storagemodel() returns table ("schema" string, "table" 
string, "column" string, "type" string, "count" bigint, columnsize bigint, 
heapsize bigint, hashes bigint, "imprints" bigint, sorted boolean, orderidx 
bigint) begin return select i."schema", i."table", i."column", i."type", 
i."count", columnsize(i."type", i.count, i."distinct"), heapsize(i."type", 
i."distinct", i."atomwidth"), hashsize(i."reference", i."count"), 
imprintsize(i."count",i."type"), i.sorted, i.orderidx from 
sys.storagemodelinput i; end;
-create procedure sys.storagemodelinit() begin delete from 
sys.storagemodelinput; insert into sys.storagemodelinput select x."schema", 
x."table", x."column", x."type", x.typewidth, x.count, 0, x.typewidth, false, 
x.sorted, x.orderidx from sys."storage"() x; update sys.storagemodelinput set 
reference = true where concat(concat("schema","table"), "column") in (select 
concat(concat("fkschema"."name", "fktable"."name"), "fkkeycol"."name") from 
"sys"."keys" as "fkkey", "sys"."objects" as "fkkeycol", "sys"."tables" as 
"fktable", "sys"."schemas" as "fkschema" where "fktable"."id" = 
"fkkey"."table_id" and "fkkey"."id" = "fkkeycol"."id" and "fkschema"."id" = 
"fktable"."schema_id" and "fkkey"."rkey" > -1); update sys.storagemodelinput 
set "distinct" = "count" where "type" = 'varchar' or "type"='clob'; end;
+create function sys."storage"() returns table ("schema" string, "table" 
string, "column" string, "type" string, "mode" string, location string, "count" 
bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, "imprints" bigint, sorted boolean, revsorted boolean, "unique" 
boolean, orderidx bigint) external name sql."storage";
+create function sys."storage"(sname string) returns table ("schema" string, 
"table" string, "column" string, "type" string, "mode" string, location string, 
"count" bigint, typewidth int, columnsize bigint, heapsize bigint, hashes 
bigint, phash boolean, "imprints" bigint, sorted boolean, revsorted boolean, 
"unique" boolean, orderidx bigint) external name sql."storage";
+create function sys."storage"(sname string, tname string) returns table 
("schema" string, "table" string, "column" string, "type" string, "mode" 
string, location string, "count" bigint, typewidth int, columnsize bigint, 
heapsize bigint, hashes bigint, phash boolean, "imprints" bigint, sorted 
boolean, revsorted boolean, "unique" boolean, orderidx bigint) external name 
sql."storage";
+create function sys."storage"(sname string, tname string, cname string) 
returns table ("schema" string, "table" string, "column" string, "type" string, 
"mode" string, location string, "count" bigint, typewidth int, columnsize 
bigint, heapsize bigint, hashes bigint, phash boolean, "imprints" bigint, 
sorted boolean, revsorted boolean, "unique" boolean, orderidx bigint) external 
name sql."storage";
+create function sys.storagemodel() returns table ("schema" string, "table" 
string, "column" string, "type" string, "count" bigint, columnsize bigint, 
heapsize bigint, hashes bigint, "imprints" bigint, sorted boolean, revsorted 
boolean, "unique" boolean, orderidx bigint) begin return select i."schema", 
i."table", i."column", i."type", i."count", columnsize(i."type", i.count, 
i."distinct"), heapsize(i."type", i."distinct", i."atomwidth"), 
hashsize(i."reference", i."count"), imprintsize(i."count",i."type"), i.sorted, 
i.revsorted, i."unique", i.orderidx from sys.storagemodelinput i; end;
+create procedure sys.storagemodelinit() begin delete from 
sys.storagemodelinput; insert into sys.storagemodelinput select x."schema", 
x."table", x."column", x."type", x.typewidth, x.count, 0, x.typewidth, false, 
x.sorted, x.revsorted, x."unique", x.orderidx from sys."storage"() x; update 
sys.storagemodelinput set reference = true where 
concat(concat("schema","table"), "column") in (select 
concat(concat("fkschema"."name", "fktable"."name"), "fkkeycol"."name") from 
"sys"."keys" as "fkkey", "sys"."objects" as "fkkeycol", "sys"."tables" as 
"fktable", "sys"."schemas" as "fkschema" where "fktable"."id" = 
"fkkey"."table_id" and "fkkey"."id" = "fkkeycol"."id" and "fkschema"."id" = 
"fktable"."schema_id" and "fkkey"."rkey" > -1); update sys.storagemodelinput 
set "distinct" = "count" where "type" = 'varchar' or "type"='clob'; end;
 create function str_to_date(s string, format string) returns date external 
name mtime."str_to_date";
 create function str_to_time(s string, format string) returns time external 
name mtime."str_to_time";
 create function str_to_timestamp(s string, format string) returns timestamp 
external name mtime."str_to_timestamp";
@@ -1652,7 +1652,9 @@ drop function pcre_replace(string, strin
 [ "storage",   "phash",        "boolean",      1,      0,      NULL,   true,   
11,     NULL    ]
 [ "storage",   "imprints",     "bigint",       64,     0,      NULL,   true,   
12,     NULL    ]
 [ "storage",   "sorted",       "boolean",      1,      0,      NULL,   true,   
13,     NULL    ]
-[ "storage",   "orderidx",     "bigint",       64,     0,      NULL,   true,   
14,     NULL    ]
+[ "storage",   "revsorted",    "boolean",      1,      0,      NULL,   true,   
14,     NULL    ]
+[ "storage",   "unique",       "boolean",      1,      0,      NULL,   true,   
15,     NULL    ]
+[ "storage",   "orderidx",     "bigint",       64,     0,      NULL,   true,   
16,     NULL    ]
 [ "storagemodel",      "schema",       "clob", 0,      0,      NULL,   true,   
0,      NULL    ]
 [ "storagemodel",      "table",        "clob", 0,      0,      NULL,   true,   
1,      NULL    ]
 [ "storagemodel",      "column",       "clob", 0,      0,      NULL,   true,   
2,      NULL    ]
@@ -1663,7 +1665,9 @@ drop function pcre_replace(string, strin
 [ "storagemodel",      "hashes",       "bigint",       64,     0,      NULL,   
true,   7,      NULL    ]
 [ "storagemodel",      "imprints",     "bigint",       64,     0,      NULL,   
true,   8,      NULL    ]
 [ "storagemodel",      "sorted",       "boolean",      1,      0,      NULL,   
true,   9,      NULL    ]
-[ "storagemodel",      "orderidx",     "bigint",       64,     0,      NULL,   
true,   10,     NULL    ]
+[ "storagemodel",      "revsorted",    "boolean",      1,      0,      NULL,   
true,   10,     NULL    ]
+[ "storagemodel",      "unique",       "boolean",      1,      0,      NULL,   
true,   11,     NULL    ]
+[ "storagemodel",      "orderidx",     "bigint",       64,     0,      NULL,   
true,   12,     NULL    ]
 [ "storagemodelinput", "schema",       "clob", 0,      0,      NULL,   true,   
0,      NULL    ]
 [ "storagemodelinput", "table",        "clob", 0,      0,      NULL,   true,   
1,      NULL    ]
 [ "storagemodelinput", "column",       "clob", 0,      0,      NULL,   true,   
2,      NULL    ]
@@ -1674,7 +1678,9 @@ drop function pcre_replace(string, strin
 [ "storagemodelinput", "atomwidth",    "int",  32,     0,      NULL,   true,   
7,      NULL    ]
 [ "storagemodelinput", "reference",    "boolean",      1,      0,      NULL,   
true,   8,      NULL    ]
 [ "storagemodelinput", "sorted",       "boolean",      1,      0,      NULL,   
true,   9,      NULL    ]
-[ "storagemodelinput", "orderidx",     "bigint",       64,     0,      NULL,   
true,   10,     NULL    ]
+[ "storagemodelinput", "revsorted",    "boolean",      1,      0,      NULL,   
true,   10,     NULL    ]
+[ "storagemodelinput", "unique",       "boolean",      1,      0,      NULL,   
true,   11,     NULL    ]
+[ "storagemodelinput", "orderidx",     "bigint",       64,     0,      NULL,   
true,   12,     NULL    ]
 [ "systemfunctions",   "function_id",  "int",  32,     0,      NULL,   true,   
0,      NULL    ]
 [ "table_types",       "table_type_id",        "smallint",     16,     0,      
NULL,   false,  0,      NULL    ]
 [ "table_types",       "table_type_name",      "varchar",      25,     0,      
NULL,   false,  1,      NULL    ]
@@ -1747,7 +1753,7 @@ drop function pcre_replace(string, strin
 % .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,     806,    9,      1,      1,      5,      5,      5 # length
+% 8,   35,     831,    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   ]
@@ -3379,12 +3385,12 @@ drop function pcre_replace(string, strin
 [ "sys",       "stddev_samp",  "create aggregate stddev_samp(val tinyint) 
returns double external name \"aggr\".\"stdev\";",   "aggr", 1,      3,      
false,  false,  false   ]
 [ "sys",       "stop", "create procedure sys.stop(tag bigint) external name 
sql.sysmon_stop;", "sql",  1,      2,      true,   false,  false   ]
 [ "sys",       "stop", "create procedure sys.stop(tag int) external name 
sql.sysmon_stop;",    "sql",  1,      2,      true,   false,  false   ]
-[ "sys",       "storage",      "create function sys.\"storage\"() returns 
table (\"schema\" string, \"table\" string, \"column\" string, \"type\" string, 
\"mode\" string, location string, \"count\" bigint, typewidth int, columnsize 
bigint, heapsize bigint, hashes bigint, phash boolean, \"imprints\" bigint, 
sorted boolean, orderidx bigint) external name sql.\"storage\";",  "sql",  1,   
   5,      false,  false,  false   ]
-[ "sys",       "storage",      "create function sys.\"storage\"(sname string) 
returns table (\"schema\" string, \"table\" string, \"column\" string, \"type\" 
string, \"mode\" string, location string, \"count\" bigint, typewidth int, 
columnsize bigint, heapsize bigint, hashes bigint, phash boolean, \"imprints\" 
bigint, sorted boolean, orderidx bigint) external name sql.\"storage\";",      
"sql",  1,      5,      false,  false,  false   ]
-[ "sys",       "storage",      "create function sys.\"storage\"(sname string, 
tname string) returns table (\"schema\" string, \"table\" string, \"column\" 
string, \"type\" string, \"mode\" string, location string, \"count\" bigint, 
typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, \"imprints\" bigint, sorted boolean, orderidx bigint) external name 
sql.\"storage\";",        "sql",  1,      5,      false,  false,  false   ]
-[ "sys",       "storage",      "create function sys.\"storage\"(sname string, 
tname string, cname string) returns table (\"schema\" string, \"table\" string, 
\"column\" string, \"type\" string, \"mode\" string, location string, \"count\" 
bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, \"imprints\" bigint, sorted boolean, orderidx bigint) external name 
sql.\"storage\";",  "sql",  1,      5,      false,  false,  false   ]
-[ "sys",       "storagemodel", "create function sys.storagemodel() returns 
table (\"schema\" string, \"table\" string, \"column\" string, \"type\" string, 
\"count\" bigint, columnsize bigint, heapsize bigint, hashes bigint, 
\"imprints\" bigint, sorted boolean, orderidx bigint) begin return select 
i.\"schema\", i.\"table\", i.\"column\", i.\"type\", i.\"count\", 
columnsize(i.\"type\", i.count, i.\"distinct\"), heapsize(i.\"type\", 
i.\"distinct\", i.\"atomwidth\"), hashsize(i.\"reference\", i.\"count\"), 
imprintsize(i.\"count\",i.\"type\"), i.sorted, i.orderidx from 
sys.storagemodelinput i; end;",     "user", 2,      5,      false,  false,  
false   ]
-[ "sys",       "storagemodelinit",     "create procedure 
sys.storagemodelinit() begin delete from sys.storagemodelinput; insert into 
sys.storagemodelinput select x.\"schema\", x.\"table\", x.\"column\", 
x.\"type\", x.typewidth, x.count, 0, x.typewidth, false, x.sorted, x.orderidx 
from sys.\"storage\"() x; update sys.storagemodelinput set reference = true 
where concat(concat(\"schema\",\"table\"), \"column\") in (select 
concat(concat(\"fkschema\".\"name\", \"fktable\".\"name\"), 
\"fkkeycol\".\"name\") from \"sys\".\"keys\" as \"fkkey\", \"sys\".\"objects\" 
as \"fkkeycol\", \"sys\".\"tables\" as \"fktable\", \"sys\".\"schemas\" as 
\"fkschema\" where \"fktable\".\"id\" = \"fkkey\".\"table_id\" and 
\"fkkey\".\"id\" = \"fkkeycol\".\"id\" and \"fkschema\".\"id\" = 
\"fktable\".\"schema_id\" and \"fkkey\".\"rkey\" > -1); update 
sys.storagemodelinput set \"distinct\" = \"count\" where \"type\" = 'varchar' 
or \"type\"='clob'; end;",       "user", 2,      2,      true,   false,  false  
 ]
+[ "sys",       "storage",      "create function sys.\"storage\"() returns 
table (\"schema\" string, \"table\" string, \"column\" string, \"type\" string, 
\"mode\" string, location string, \"count\" bigint, typewidth int, columnsize 
bigint, heapsize bigint, hashes bigint, phash boolean, \"imprints\" bigint, 
sorted boolean, revsorted boolean, \"unique\" boolean, orderidx bigint) 
external name sql.\"storage\";",   "sql",  1,      5,      false,  false,  
false   ]
+[ "sys",       "storage",      "create function sys.\"storage\"(sname string) 
returns table (\"schema\" string, \"table\" string, \"column\" string, \"type\" 
string, \"mode\" string, location string, \"count\" bigint, typewidth int, 
columnsize bigint, heapsize bigint, hashes bigint, phash boolean, \"imprints\" 
bigint, sorted boolean, revsorted boolean, \"unique\" boolean, orderidx bigint) 
external name sql.\"storage\";",       "sql",  1,      5,      false,  false,  
false   ]
+[ "sys",       "storage",      "create function sys.\"storage\"(sname string, 
tname string) returns table (\"schema\" string, \"table\" string, \"column\" 
string, \"type\" string, \"mode\" string, location string, \"count\" bigint, 
typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, \"imprints\" bigint, sorted boolean, revsorted boolean, \"unique\" 
boolean, orderidx bigint) external name sql.\"storage\";", "sql",  1,      5,   
   false,  false,  false   ]
+[ "sys",       "storage",      "create function sys.\"storage\"(sname string, 
tname string, cname string) returns table (\"schema\" string, \"table\" string, 
\"column\" string, \"type\" string, \"mode\" string, location string, \"count\" 
bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, phash 
boolean, \"imprints\" bigint, sorted boolean, revsorted boolean, \"unique\" 
boolean, orderidx bigint) external name sql.\"storage\";",   "sql",  1,      5, 
     false,  false,  false   ]
+[ "sys",       "storagemodel", "create function sys.storagemodel() returns 
table (\"schema\" string, \"table\" string, \"column\" string, \"type\" string, 
\"count\" bigint, columnsize bigint, heapsize bigint, hashes bigint, 
\"imprints\" bigint, sorted boolean, revsorted boolean, \"unique\" boolean, 
orderidx bigint) begin return select i.\"schema\", i.\"table\", i.\"column\", 
i.\"type\", i.\"count\", columnsize(i.\"type\", i.count, i.\"distinct\"), 
heapsize(i.\"type\", i.\"distinct\", i.\"atomwidth\"), 
hashsize(i.\"reference\", i.\"count\"), imprintsize(i.\"count\",i.\"type\"), 
i.sorted, i.revsorted, i.\"unique\", i.orderidx from sys.storagemodelinput i; 
end;",   "user", 2,      5,      false,  false,  false   ]
+[ "sys",       "storagemodelinit",     "create procedure 
sys.storagemodelinit() begin delete from sys.storagemodelinput; insert into 
sys.storagemodelinput select x.\"schema\", x.\"table\", x.\"column\", 
x.\"type\", x.typewidth, x.count, 0, x.typewidth, false, x.sorted, x.revsorted, 
x.\"unique\", x.orderidx from sys.\"storage\"() x; update sys.storagemodelinput 
set reference = true where concat(concat(\"schema\",\"table\"), \"column\") in 
(select concat(concat(\"fkschema\".\"name\", \"fktable\".\"name\"), 
\"fkkeycol\".\"name\") from \"sys\".\"keys\" as \"fkkey\", \"sys\".\"objects\" 
as \"fkkeycol\", \"sys\".\"tables\" as \"fktable\", \"sys\".\"schemas\" as 
\"fkschema\" where \"fktable\".\"id\" = \"fkkey\".\"table_id\" and 
\"fkkey\".\"id\" = \"fkkeycol\".\"id\" and \"fkschema\".\"id\" = 
\"fktable\".\"schema_id\" and \"fkkey\".\"rkey\" > -1); update 
sys.storagemodelinput set \"distinct\" = \"count\" where \"type\" = 'varchar' 
or \"type\"='clob'; end;",    "user", 2,      2,      true,   false,  false   ]
 [ "sys",       "str_to_date",  "create function str_to_date(s string, format 
string) returns date external name mtime.\"str_to_date\";",       "mtime",      
  1,      1,      false,  false,  false   ]
 [ "sys",       "str_to_time",  "create function str_to_time(s string, format 
string) returns time external name mtime.\"str_to_time\";",       "mtime",      
  1,      1,      false,  false,  false   ]
 [ "sys",       "str_to_timestamp",     "create function str_to_timestamp(s 
string, format string) returns timestamp external name 
mtime.\"str_to_timestamp\";",        "mtime",        1,      1,      false,  
false,  false   ]
@@ -3481,7 +3487,7 @@ drop function pcre_replace(string, strin
 % sys.s,       sys.f,  .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, 
.arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16, .arg16 # table_name
 % name,        name,   name1,  type1,  type_digits1,   type_scale1,    inout1, 
name2,  type2,  type_digits2,   type_scale2,    inout2, name3,  type3,  
type_digits3,   type_scale3,    inout3, name4,  type4,  type_digits4,   
type_scale4,    inout4, name5,  type5,  type_digits5,   type_scale5,    inout5, 
name6,  type6,  type_digits6,   type_scale6,    inout6, name7,  type7,  
type_digits7,   type_scale7,    inout7, name8,  type8,  type_digits8,   
type_scale8,    inout8, name9,  type9,  type_digits9,   type_scale9,    inout9, 
name10, type10, type_digits10,  type_scale10,   inout10,        name11, type11, 
type_digits11,  type_scale11,   inout11,        name12, type12, type_digits12,  
type_scale12,   inout12,        name13, type13, type_digits13,  type_scale13,   
inout13,        name14, type14, type_digits14,  type_scale14,   inout14,        
name15, type15, type_digits15,  type_scale15,   inout15 # name
 % varchar,     varchar,        varchar,        varchar,        int,    int,    
tinyint,        varchar,        varchar,        int,    int,    tinyint,        
varchar,        varchar,        int,    int,    tinyint,        varchar,        
varchar,        int,    int,    tinyint,        varchar,        varchar,        
int,    int,    tinyint,        varchar,        varchar,        int,    int,    
tinyint,        varchar,        varchar,        int,    int,    tinyint,        
varchar,        varchar,        int,    int,    tinyint,        varchar,        
varchar,        int,    int,    tinyint,        varchar,        varchar,        
int,    int,    tinyint,        varchar,        varchar,        int,    int,    
tinyint,        varchar,        varchar,        int,    int,    tinyint,        
varchar,        varchar,        int,    int,    tinyint,        varchar,        
varchar,        int,    int,    tinyint,        varchar,        varchar,        
int,    int,    tinyint # type
-% 8,   35,     16,     14,     4,      1,      1,      16,     14,     3,      
1,      1,      27,     12,     3,      1,      1,      12,     7,      2,      
1,      1,      10,     7,      2,      1,      1,      8,      7,      2,      
1,      1,      9,      6,      2,      1,      1,      10,     6,      2,      
1,      1,      8,      7,      2,      1,      1,      8,      7,      2,      
1,      1,      5,      7,      2,      1,      1,      8,      6,      2,      
1,      1,      6,      7,      1,      1,      1,      8,      6,      2,      
1,      1,      5,      4,      1,      1,      1 # length
+% 8,   35,     16,     14,     4,      1,      1,      16,     14,     3,      
1,      1,      27,     12,     3,      1,      1,      12,     7,      2,      
1,      1,      10,     7,      2,      1,      1,      8,      7,      2,      
1,      1,      9,      6,      2,      1,      1,      10,     6,      2,      
1,      1,      8,      7,      2,      1,      1,      9,      7,      2,      
1,      1,      6,      7,      2,      1,      1,      8,      6,      2,      
1,      1,      6,      7,      1,      1,      1,      9,      7,      1,      
1,      1,      6,      7,      1,      1,      1 # length
 [ "bam",       "bam_drop_file",        "dbschema",     "smallint",     16,     
0,      1,      NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL    ]
 [ "bam",       "bam_export",   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL    ]
 [ "bam",       "bam_flag",     "flag", "smallint",     16,     0,      1,      
"name", "clob", 0,      0,      1,      NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   
NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL    
]
@@ -5113,11 +5119,11 @@ drop function pcre_replace(string, strin
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to