Changeset: db95892817bd for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=db95892817bd Modified Files: sql/backends/monet5/sql_upgrades.c sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: default Log Message:
Fix upgrade from Oct2014. diffs (197 lines): diff --git a/sql/backends/monet5/sql_upgrades.c b/sql/backends/monet5/sql_upgrades.c --- a/sql/backends/monet5/sql_upgrades.c +++ b/sql/backends/monet5/sql_upgrades.c @@ -1215,10 +1215,16 @@ sql_update_feb2015(Client c) /* change to 75_storagemodel */ pos += snprintf(buf+pos, bufsize - pos, "drop view sys.storagemodel;\n"); pos += snprintf(buf+pos, bufsize - pos, "drop view sys.tablestoragemodel;\n"); + pos += snprintf(buf+pos, bufsize - pos, "drop view sys.storage;\n"); pos += snprintf(buf+pos, bufsize - pos, "drop function sys.storagemodel;\n"); pos += snprintf(buf+pos, bufsize - pos, "drop function sys.imprintsize;\n"); pos += snprintf(buf+pos, bufsize - pos, "drop function sys.columnsize;\n"); + pos += snprintf(buf+pos, bufsize - pos, "drop function sys.storage;\n"); pos += snprintf(buf+pos, bufsize - pos, "\ +create function sys.storage()\n\ +returns table (\"schema\" string, \"table\" string, \"column\" string, \"type\" string, location string, \"count\" bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, imprints bigint, sorted boolean)\n\ +external name sql.storage;\n\ +create view sys.storage as select * from sys.storage();\n\ create function sys.columnsize(nme string, i bigint, d bigint)\n\ returns bigint\n\ begin\n\ @@ -1353,9 +1359,9 @@ where qd.id = ql.id and qd.owner = user; pos += snprintf(buf+pos, bufsize - pos, "create view sys.tracelog as select * from sys.tracelog();\n"); - pos += snprintf(buf + pos, bufsize - pos, "insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions));\n"); + pos += snprintf(buf + pos, bufsize - pos, "insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storage', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions));\n"); pos += snprintf(buf + pos, bufsize - pos, "delete from systemfunctions where function_id not in (select id from functions);\n"); - pos += snprintf(buf + pos, bufsize - pos, "update sys._tables set system = true where name in ('statistics', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys');\n"); + pos += snprintf(buf + pos, bufsize - pos, "update sys._tables set system = true where name in ('statistics', 'storage', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys');\n"); { char *msg; @@ -1369,6 +1375,8 @@ where qd.id = ql.id and qd.owner = user; if ((s = mvc_bind_schema(sql, "sys")) != NULL) { sql_table *t; + if ((t = mvc_bind_table(sql, s, "storage")) != NULL) + t->system = 0; if ((t = mvc_bind_table(sql, s, "storagemodel")) != NULL) t->system = 0; if ((t = mvc_bind_table(sql, s, "tablestoragemodel")) != NULL) @@ -1395,15 +1403,6 @@ where qd.id = ql.id and qd.owner = user; } assert(pos < bufsize); - /* update the 75_storagemodel script */ - pos += snprintf(buf + pos, bufsize - pos, "drop function sys.storage();\n"); - pos += snprintf(buf + pos, bufsize - pos, - "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)" - "external name sql.\"storage\";\n" - ); printf("Running database upgrade commands:\n%s\n", buf); err = SQLstatementIntern(c, &buf, "update", 1, 0, NULL); GDKfree(buf); diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out --- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out +++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out @@ -38,9 +38,15 @@ create filter function sys."ilike"(val s create filter function sys."ilike"(val string, pat string) external name algebra."ilike"; drop view sys.storagemodel; drop view sys.tablestoragemodel; +drop view sys.storage; drop function sys.storagemodel; drop function sys.imprintsize; drop function sys.columnsize; +drop function sys.storage; +create function sys.storage() +returns table ("schema" string, "table" string, "column" string, "type" string, location string, "count" bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, imprints bigint, sorted boolean) +external name sql.storage; +create view sys.storage as select * from sys.storage(); create function sys.columnsize(nme string, i bigint, d bigint) returns bigint begin @@ -161,9 +167,9 @@ create function sys.tracelog() stmt string ) external name sql.dump_trace; create view sys.tracelog as select * from sys.tracelog(); -insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); +insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storage', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); delete from systemfunctions where function_id not in (select id from functions); -update sys._tables set system = true where name in ('statistics', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys'); +update sys._tables set system = true where name in ('statistics', 'storage', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys'); drop procedure sys.cluster1; drop procedure sys.cluster2; set schema "testschema"; diff --git a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 --- a/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 +++ b/sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 @@ -90,9 +90,15 @@ create filter function sys."ilike"(val s create filter function sys."ilike"(val string, pat string) external name algebra."ilike"; drop view sys.storagemodel; drop view sys.tablestoragemodel; +drop view sys.storage; drop function sys.storagemodel; drop function sys.imprintsize; drop function sys.columnsize; +drop function sys.storage; +create function sys.storage() +returns table ("schema" string, "table" string, "column" string, "type" string, location string, "count" bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, imprints bigint, sorted boolean) +external name sql.storage; +create view sys.storage as select * from sys.storage(); create function sys.columnsize(nme string, i bigint, d bigint) returns bigint begin @@ -213,9 +219,9 @@ create function sys.tracelog() stmt string ) external name sql.dump_trace; create view sys.tracelog as select * from sys.tracelog(); -insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); +insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storage', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); delete from systemfunctions where function_id not in (select id from functions); -update sys._tables set system = true where name in ('statistics', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys'); +update sys._tables set system = true where name in ('statistics', 'storage', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys'); drop procedure sys.cluster1; drop procedure sys.cluster2; set schema "testschema"; diff --git a/sql/test/testdb-upgrade/Tests/upgrade.stable.out b/sql/test/testdb-upgrade/Tests/upgrade.stable.out --- a/sql/test/testdb-upgrade/Tests/upgrade.stable.out +++ b/sql/test/testdb-upgrade/Tests/upgrade.stable.out @@ -18,6 +18,15 @@ stdout of test 'upgrade` in directory 's Ready. Running database upgrade commands: set schema "sys"; +CREATE FUNCTION "left_shift"(i1 inet, i2 inet) RETURNS boolean EXTERNAL NAME inet."<<"; +CREATE FUNCTION "right_shift"(i1 inet, i2 inet) RETURNS boolean EXTERNAL NAME inet.">>"; +CREATE FUNCTION "left_shift_assign"(i1 inet, i2 inet) RETURNS boolean EXTERNAL NAME inet."<<="; +CREATE FUNCTION "right_shift_assign"(i1 inet, i2 inet) RETURNS boolean EXTERNAL NAME inet.">>="; +insert into sys.systemfunctions (select id from sys.functions where name in ('left_shift', 'right_shift', 'left_shift_assign', 'right_shift_assign') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); +set schema "testschema"; + +Running database upgrade commands: +set schema "sys"; drop filter function sys."like"; create filter function sys."like"(val string, pat string, esc string) external name algebra."like"; create filter function sys."like"(val string, pat string) external name algebra."like"; @@ -26,9 +35,15 @@ create filter function sys."ilike"(val s create filter function sys."ilike"(val string, pat string) external name algebra."ilike"; drop view sys.storagemodel; drop view sys.tablestoragemodel; +drop view sys.storage; drop function sys.storagemodel; drop function sys.imprintsize; drop function sys.columnsize; +drop function sys.storage; +create function sys.storage() +returns table ("schema" string, "table" string, "column" string, "type" string, location string, "count" bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, imprints bigint, sorted boolean) +external name sql.storage; +create view sys.storage as select * from sys.storage(); create function sys.columnsize(nme string, i bigint, d bigint) returns bigint begin @@ -149,9 +164,9 @@ create function sys.tracelog() stmt string ) external name sql.dump_trace; create view sys.tracelog as select * from sys.tracelog(); -insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); +insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storage', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); delete from systemfunctions where function_id not in (select id from functions); -update sys._tables set system = true where name in ('statistics', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys'); +update sys._tables set system = true where name in ('statistics', 'storage', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys'); drop procedure sys.cluster1; drop procedure sys.cluster2; set schema "testschema"; diff --git a/sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 b/sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 --- a/sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 +++ b/sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 @@ -87,9 +87,15 @@ create filter function sys."ilike"(val s create filter function sys."ilike"(val string, pat string) external name algebra."ilike"; drop view sys.storagemodel; drop view sys.tablestoragemodel; +drop view sys.storage; drop function sys.storagemodel; drop function sys.imprintsize; drop function sys.columnsize; +drop function sys.storage; +create function sys.storage() +returns table ("schema" string, "table" string, "column" string, "type" string, location string, "count" bigint, typewidth int, columnsize bigint, heapsize bigint, hashes bigint, imprints bigint, sorted boolean) +external name sql.storage; +create view sys.storage as select * from sys.storage(); create function sys.columnsize(nme string, i bigint, d bigint) returns bigint begin @@ -210,9 +216,9 @@ create function sys.tracelog() stmt string ) external name sql.dump_trace; create view sys.tracelog as select * from sys.tracelog(); -insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); +insert into sys.systemfunctions (select id from sys.functions where name in ('like', 'ilike', 'columnsize', 'imprintsize', 'storage', 'storagemodel', 'querylog_calls', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); delete from systemfunctions where function_id not in (select id from functions); -update sys._tables set system = true where name in ('statistics', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys'); +update sys._tables set system = true where name in ('statistics', 'storage', 'storagemodel', 'tablestoragemodel', 'querylog_calls', 'querylog_history', 'tracelog') and schema_id = (select id from sys.schemas where name = 'sys'); drop procedure sys.cluster1; drop procedure sys.cluster2; set schema "testschema"; _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list