[prev in list] [next in list] [prev in thread] [next in thread] 

List:       monetdb-checkins
Subject:    MonetDB: sfcgal - Merge with the default
From:       Romulo Goncalves <commits+R.A.Goncalves=cwi.nl () monetdb ! org>
Date:       2016-04-27 11:50:43
Message-ID: hg.f49de68b1404.1461757843.6315528441665844383 () monetdb2 ! cwi-incubator ! nl
[Download RAW message or body]

Changeset: f49de68b1404 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f49de68b1404
Modified Files:
	clients/Tests/SQL-dump.stable.out
	clients/Tests/SQL-dump.stable.out.int128
	clients/Tests/exports.stable.out
	gdk/gdk.h
	gdk/gdk_private.h
	monetdb5/optimizer/opt_reorder.c
	sql/backends/monet5/sql.c
	sql/backends/monet5/sql_execute.c
	sql/backends/monet5/sql_execute.h
	sql/backends/monet5/sql_scenario.c
	sql/backends/monet5/sql_scenario.h
	sql/include/sql_catalog.h
	sql/jdbc/tests/Tests/Test_Dobjects.stable.out
	sql/scripts/75_storagemodel.sql
	sql/server/sql_mvc.h
	sql/server/sql_parser.y
	sql/server/sql_scan.c
	sql/test/BugTracker-2010/Tests/limit_in_prepare.Bug-2552.sql
	sql/test/BugTracker-2011/Tests/count-count-distinct.Bug-2808.sql
	sql/test/BugTracker-2012/Tests/aggregate_vs_positional_column_crash.Bug-3085.sql
	sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.sql
	sql/test/BugTracker-2012/Tests/predicate_select.Bug-3090.stable.out
	sql/test/BugTracker-2013/Tests/qualified_aggrname.Bug-3332.sql
	sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.sql
	sql/test/BugTracker-2013/Tests/swapped_likejoin.Bug-3375.stable.out
	sql/test/BugTracker-2014/Tests/select-having.Bug-3458.sql
	sql/test/BugTracker-2015/Tests/cardinality.Bug-3761.sql
	sql/test/BugTracker-2016/Tests/DISTINCT_with_correlated_scalar_subquery_crashes_mserver.Bug-3920.sql
  sql/test/BugTracker-2016/Tests/storagemodel.Bug-3923.sql
	sql/test/BugTracker-2016/Tests/storagemodel.Bug-3923.stable.out
	sql/test/Tests/systemfunctions.stable.out
	sql/test/Tests/systemfunctions.stable.out.int128
	sql/test/bugs/Tests/crash_order_by.sql
	sql/test/bugs/Tests/simple_view.sql
	sql/test/bugs/insert_delete-bug-sf-904025.sql
	sql/test/orderidx/Tests/simpletable.sql
	sql/test/orderidx/Tests/smalltable.sql
	sql/test/pg_regress/Tests/vacuum.sql
	sql/test/pg_regress/Tests/without_oid.sql
Branch: sfcgal
Log Message:

Merge with the default


diffs (truncated from 1102 to 300 lines):

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
@@ -846,7 +846,7 @@ create view sys.sessions as select * fro
 create view sys."storage" as select * from sys."storage"();
 create view sys.storagemodel as select * from sys.storagemodel();
 SELECT "id", "name", "schema_id", "query", CAST(CASE WHEN "system" THEN "type" + 10 \
ELSE (CASE WHEN "commit_action" = 0 THEN "type" ELSE "type" + 20 END) END AS \
SMALLINT) AS "type", "system", "commit_action", "access", CASE WHEN (NOT "system" AND \
"commit_action" > 0) THEN 1 ELSE 0 END AS "temporary" FROM "sys"."_tables" WHERE \
"type" <> 2 UNION ALL SELECT "id", "name", "schema_id", "query", CAST("type" + 30 AS \
SMALLINT) AS "type", "system", "commit_action", "access", 1 AS "temporary" FROM \
                "tmp"."_tables";
-create view sys.tablestoragemodel as select "schema","table",max(count) as "count", \
sum(columnsize) as columnsize, sum(heapsize) as heapsize, sum(hashes) as hashes, \
sum(imprints) as imprints, sum(case when sorted = false then 8 * count else 0 end) as \
auxiliary from sys.storagemodel() group by "schema","table"; +create view \
sys.tablestoragemodel as select "schema","table",max(count) as "count", \
sum(columnsize) as columnsize, sum(heapsize) as heapsize, sum(hashes) as hashes, \
sum("imprints") as "imprints", sum(case when sorted = false then 8 * count else 0 \
end) as auxiliary from sys.storagemodel() group by "schema","table";  create view \
sys.tracelog as select * from sys.tracelog();  SELECT u."name" AS "name", \
ui."fullname", ui."default_schema" FROM db_users() AS u LEFT JOIN \
"sys"."db_user_info" AS ui ON u."name" = ui."name" ;  create function "abbrev" (p \
inet) returns clob external name inet."abbrev"; @@ -1160,11 +1160,11 @@ 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 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 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"; \
@@ -1349,7 +1349,7 @@ drop function pcre_replace(string, strin  [ \
"sys",	"systemfunctions",	NULL,	0,	true,	0,	0	]  [ \
"sys",	"table_types",	NULL,	0,	true,	0,	0	]  [ "sys",	"tables",	"SELECT \"id\", \
\"name\", \"schema_id\", \"query\", CAST(CASE WHEN \"system\" THEN \"type\" + 10 /* \
system table/view */ ELSE (CASE WHEN \"commit_action\" = 0 THEN \"type\" /* \
table/view */ ELSE \"type\" + 20 /* global temp table */ END) END AS SMALLINT) AS \
\"type\", \"system\", \"commit_action\", \"access\", CASE WHEN (NOT \"system\" AND \
\"commit_action\" > 0) THEN 1 ELSE 0 END AS \"temporary\" FROM \"sys\".\"_tables\" \
WHERE \"type\" <> 2 UNION ALL SELECT \"id\", \"name\", \"schema_id\", \"query\", \
CAST(\"type\" + 30 /* local temp table */ AS SMALLINT) AS \"type\", \"system\", \
\"commit_action\", \"access\", 1 AS \"temporary\" FROM \
                \"tmp\".\"_tables\";",	1,	true,	0,	0	]
-[ "sys",	"tablestoragemodel",	"create view sys.tablestoragemodel as select \
\"schema\",\"table\",max(count) as \"count\", sum(columnsize) as columnsize, \
sum(heapsize) as heapsize, sum(hashes) as hashes, sum(imprints) as imprints, sum(case \
when sorted = false then 8 * count else 0 end) as auxiliary from sys.storagemodel() \
group by \"schema\",\"table\";",	1,	true,	0,	0	] +[ \
"sys",	"tablestoragemodel",	"create view sys.tablestoragemodel as select \
\"schema\",\"table\",max(count) as \"count\", sum(columnsize) as columnsize, \
sum(heapsize) as heapsize, sum(hashes) as hashes, sum(\"imprints\") as \"imprints\", \
sum(case when sorted = false then 8 * count else 0 end) as auxiliary from \
sys.storagemodel() group by \"schema\",\"table\";",	1,	true,	0,	0	]  [ \
"sys",	"tracelog",	"create view sys.tracelog as select * from \
sys.tracelog();",	1,	true,	0,	0	]  [ "sys",	"triggers",	NULL,	0,	true,	0,	0	]
 [ "sys",	"types",	NULL,	0,	true,	0,	0	]
@@ -3289,11 +3289,11 @@ drop function pcre_replace(string, strin
 [ "sys",	"stddev_samp",	"create aggregate stddev_samp(val wrd) 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",	"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",	"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	]
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
@@ -842,7 +842,7 @@ create view sys.sessions as select * fro
 create view sys."storage" as select * from sys."storage"();
 create view sys.storagemodel as select * from sys.storagemodel();
 SELECT "id", "name", "schema_id", "query", CAST(CASE WHEN "system" THEN "type" + 10 \
ELSE (CASE WHEN "commit_action" = 0 THEN "type" ELSE "type" + 20 END) END AS \
SMALLINT) AS "type", "system", "commit_action", "access", CASE WHEN (NOT "system" AND \
"commit_action" > 0) THEN 1 ELSE 0 END AS "temporary" FROM "sys"."_tables" WHERE \
"type" <> 2 UNION ALL SELECT "id", "name", "schema_id", "query", CAST("type" + 30 AS \
SMALLINT) AS "type", "system", "commit_action", "access", 1 AS "temporary" FROM \
                "tmp"."_tables";
-create view sys.tablestoragemodel as select "schema","table",max(count) as "count", \
sum(columnsize) as columnsize, sum(heapsize) as heapsize, sum(hashes) as hashes, \
sum(imprints) as imprints, sum(case when sorted = false then 8 * count else 0 end) as \
auxiliary from sys.storagemodel() group by "schema","table"; +create view \
sys.tablestoragemodel as select "schema","table",max(count) as "count", \
sum(columnsize) as columnsize, sum(heapsize) as heapsize, sum(hashes) as hashes, \
sum("imprints") as "imprints", sum(case when sorted = false then 8 * count else 0 \
end) as auxiliary from sys.storagemodel() group by "schema","table";  create view \
sys.tracelog as select * from sys.tracelog();  SELECT u."name" AS "name", \
ui."fullname", ui."default_schema" FROM db_users() AS u LEFT JOIN \
"sys"."db_user_info" AS ui ON u."name" = ui."name" ;  create function "abbrev" (p \
inet) returns clob external name inet."abbrev"; @@ -1165,11 +1165,11 @@ 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 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 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"; \
@@ -1356,7 +1356,7 @@ drop function pcre_replace(string, strin  [ \
"sys",	"systemfunctions",	NULL,	0,	true,	0,	0	]  [ \
"sys",	"table_types",	NULL,	0,	true,	0,	0	]  [ "sys",	"tables",	"SELECT \"id\", \
\"name\", \"schema_id\", \"query\", CAST(CASE WHEN \"system\" THEN \"type\" + 10 /* \
system table/view */ ELSE (CASE WHEN \"commit_action\" = 0 THEN \"type\" /* \
table/view */ ELSE \"type\" + 20 /* global temp table */ END) END AS SMALLINT) AS \
\"type\", \"system\", \"commit_action\", \"access\", CASE WHEN (NOT \"system\" AND \
\"commit_action\" > 0) THEN 1 ELSE 0 END AS \"temporary\" FROM \"sys\".\"_tables\" \
WHERE \"type\" <> 2 UNION ALL SELECT \"id\", \"name\", \"schema_id\", \"query\", \
CAST(\"type\" + 30 /* local temp table */ AS SMALLINT) AS \"type\", \"system\", \
\"commit_action\", \"access\", 1 AS \"temporary\" FROM \
                \"tmp\".\"_tables\";",	1,	true,	0,	0	]
-[ "sys",	"tablestoragemodel",	"create view sys.tablestoragemodel as select \
\"schema\",\"table\",max(count) as \"count\", sum(columnsize) as columnsize, \
sum(heapsize) as heapsize, sum(hashes) as hashes, sum(imprints) as imprints, sum(case \
when sorted = false then 8 * count else 0 end) as auxiliary from sys.storagemodel() \
group by \"schema\",\"table\";",	1,	true,	0,	0	] +[ \
"sys",	"tablestoragemodel",	"create view sys.tablestoragemodel as select \
\"schema\",\"table\",max(count) as \"count\", sum(columnsize) as columnsize, \
sum(heapsize) as heapsize, sum(hashes) as hashes, sum(\"imprints\") as \"imprints\", \
sum(case when sorted = false then 8 * count else 0 end) as auxiliary from \
sys.storagemodel() group by \"schema\",\"table\";",	1,	true,	0,	0	]  [ \
"sys",	"tracelog",	"create view sys.tracelog as select * from \
sys.tracelog();",	1,	true,	0,	0	]  [ "sys",	"triggers",	NULL,	0,	true,	0,	0	]
 [ "sys",	"types",	NULL,	0,	true,	0,	0	]
@@ -3480,11 +3480,11 @@ drop function pcre_replace(string, strin
 [ "sys",	"stddev_samp",	"create aggregate stddev_samp(val wrd) 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",	"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",	"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	]
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -268,6 +268,7 @@ var_t HEAP_malloc(Heap *heap, size_t nby
 gdk_return HEAPextend(Heap *h, size_t size, int mayshare);
 size_t HEAPmemsize(Heap *h);
 size_t HEAPvmsize(Heap *h);
+void IMPSdestroy(BAT *b);
 lng IMPSimprintsize(BAT *b);
 int MT_check_nr_cores(void);
 int MT_create_thread(MT_Id *t, void( *function)(void *), void *arg, enum \
MT_thr_detach d); @@ -1566,6 +1567,7 @@ int OPTmultiplexImplementation(Client cn
 str OPTmultiplexSimple(Client cntxt, MalBlkPtr mb);
 str OPTorcam(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 int OPTorcamImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
+int OPTpostfixImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p);
 int OPTprofilerImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr \
p);  int OPTprojectionpathImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr stk, \
InstrPtr p);  int OPTpushselectImplementation(Client cntxt, MalBlkPtr mb, MalStkPtr \
                stk, InstrPtr pci);
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2021,6 +2021,7 @@ gdk_export gdk_return BAThash(BAT *b, BU
  */
 
 gdk_export gdk_return BATimprints(BAT *b);
+gdk_export void IMPSdestroy(BAT *b);
 gdk_export lng IMPSimprintsize(BAT *b);
 
 /* The ordered index structure */
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -169,8 +169,6 @@ void BBPdump(void);		/* never called: fo
 	__attribute__((__visibility__("hidden")));
 __hidden int HEAPwarm(Heap *h)
 	__attribute__((__visibility__("hidden")));
-__hidden void IMPSdestroy(BAT *b)
-	__attribute__((__visibility__("hidden")));
 __hidden void IMPSfree(BAT *b)
 	__attribute__((__visibility__("hidden")));
 __hidden int IMPSgetbin(int tpe, bte bits, const char *restrict bins, const void \
                *restrict v)
diff --git a/monetdb5/optimizer/opt_reorder.c b/monetdb5/optimizer/opt_reorder.c
--- a/monetdb5/optimizer/opt_reorder.c
+++ b/monetdb5/optimizer/opt_reorder.c
@@ -206,7 +206,7 @@ OPTbreadthfirst(Client cntxt, MalBlkPtr 
 static int
 OPTpostponeAppends(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
 {
-	int i,j,k=0, actions =0, last;
+	int i,j,k=0, actions =0, last=-1;
 	InstrPtr *old, *appends;
 	int limit;
 	(void) cntxt;
diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -610,6 +610,12 @@ alter_table(Client cntxt, mvc *sql, char
 				OIDXcreateImplementation(cntxt, newBatType(TYPE_void,b->ttype), b, -1);
 				BBPunfix(b->batCacheid);
 			}
+			if (i->type == imprints_idx) {
+				sql_kc *ic = i->columns->h->data;
+				BAT *b = mvc_bind(sql, nt->s->base.name, nt->base.name, ic->c->base.name, 0);
+				BATimprints(b);
+				BBPunfix(b->batCacheid);
+			}
 			mvc_copy_idx(sql, nt, i);
 		}
 	}
@@ -754,6 +760,12 @@ drop_index(Client cntxt, mvc *sql, char 
 			OIDXdropImplementation(cntxt, b);
 			BBPunfix(b->batCacheid);
 		}
+		if (i->type == imprints_idx) {
+			sql_kc *ic = i->columns->h->data;
+			BAT *b = mvc_bind(sql, s->base.name, ic->c->t->base.name, ic->c->base.name, 0);
+			IMPSdestroy(b);
+			BBPunfix(b->batCacheid);
+		}
 		mvc_drop_idx(sql, s, i);
 	}
 	return NULL;
@@ -5101,123 +5113,6 @@ sql_storage(Client cntxt, MalBlkPtr mb, 
 	return MAL_SUCCEED;
 }
 
-str
-RAstatement(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-	int pos = 0;
-	str *expr = getArgReference_str(stk, pci, 1);
-	bit *opt = getArgReference_bit(stk, pci, 2);
-	backend *b = NULL;
-	mvc *m = NULL;
-	str msg;
-	sql_rel *rel;
-	list *refs;
-
-	if ((msg = getSQLContext(cntxt, mb, &m, &b)) != NULL)
-		return msg;
-	if ((msg = checkSQLContext(cntxt)) != NULL)
-		return msg;
-	if (!m->sa)
-		m->sa = sa_create();
-	refs = sa_list(m->sa);
-	rel = rel_read(m, *expr, &pos, refs);
-	if (rel) {
-		int oldvtop = cntxt->curprg->def->vtop;
-		int oldstop = cntxt->curprg->def->stop;
-		stmt *s;
-		MalStkPtr oldglb = cntxt->glb;
-
-		if (*opt)
-			rel = rel_optimizer(m, rel);
-		s = output_rel_bin(m, rel);
-		rel_destroy(rel);
-
-		MSinitClientPrg(cntxt, "user", "test");
-
-		/* generate MAL code */
-		backend_callinline(b, cntxt, s, 1);
-		addQueryToCache(cntxt);
-
-		msg = (str) runMAL(cntxt, cntxt->curprg->def, 0, 0);
-		if (!msg) {
-			resetMalBlk(cntxt->curprg->def, oldstop);
-			freeVariables(cntxt, cntxt->curprg->def, NULL, oldvtop);
-			if( !(cntxt->glb == 0 || cntxt->glb == oldglb))
-				msg= createException(MAL,"sql","global stack leakage");	/* detect leak */
-		}
-		cntxt->glb = oldglb;
-	}
-	return msg;
-}
-
-str
-RAstatement2(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
-{
-	int pos = 0;
-	str *mod = getArgReference_str(stk, pci, 1);
-	str *nme = getArgReference_str(stk, pci, 2);
-	str *expr = getArgReference_str(stk, pci, 3);
-	str *sig = getArgReference_str(stk, pci, 4), c = *sig;
-	backend *b = NULL;
-	mvc *m = NULL;
-	str msg;
-	sql_rel *rel;
-	list *refs, *ops;
-	char buf[BUFSIZ];
-
-	if ((msg = getSQLContext(cntxt, mb, &m, &b)) != NULL)
-		return msg;
-	if ((msg = checkSQLContext(cntxt)) != NULL)
-		return msg;
-	if (!m->sa)
-		m->sa = sa_create();
-
-       	ops = sa_list(m->sa);
-	snprintf(buf, BUFSIZ, "%s %s", *sig, *expr);
-	while (c && *c && !isspace(*c)) {
-		char *vnme = c, *tnme; 
-		char *p = strchr(++c, (int)' ');
-		int d,s,nr;
-		sql_subtype t;
-		atom *a;
-
-		*p++ = 0;
-		vnme = sa_strdup(m->sa, vnme);
-		nr = strtol(vnme+1, NULL, 10);
-		tnme = p;
-		p = strchr(p, (int)'(');
-		*p++ = 0;
-		tnme = sa_strdup(m->sa, tnme);
-
-		d = strtol(p, &p, 10);
-		p++; /* skip , */
-		s = strtol(p, &p, 10);
-		
-		sql_find_subtype(&t, tnme, d, s);
-		a = atom_general(m->sa, &t, NULL);
-		/* the argument list may have holes and maybe out of order, ie
-		 * done use sql_add_arg, but special numbered version
-		 * sql_set_arg(m, a, nr);
-		 * */
-		sql_set_arg(m, nr, a);
-		append(ops, stmt_alias(m->sa, stmt_varnr(m->sa, nr, &t), NULL, vnme));
-		c = strchr(p, (int)',');
-		if (c)
-			c++;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic