Changeset: 356f82fec85d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=356f82fec85d Modified Files: sql/backends/monet5/sql_scenario.c sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out Branch: Oct2014 Log Message:
Recreated system functions need to be marked as such; approved upgrade output. diffs (94 lines): diff --git a/sql/backends/monet5/sql_scenario.c b/sql/backends/monet5/sql_scenario.c --- a/sql/backends/monet5/sql_scenario.c +++ b/sql/backends/monet5/sql_scenario.c @@ -1069,7 +1069,7 @@ create aggregate json.tojsonarray( x dou F_FUNC); pos += snprintf(buf + pos, bufsize - pos, - "insert into sys.systemfunctions (select f.id from sys.functions f, sys.schemas s where f.name in ('bbp', 'generate_series', 'storage', 'storagemodel') and f.type = %d and f.schema_id = s.id and s.name = 'sys');\n", + "insert into sys.systemfunctions (select f.id from sys.functions f, sys.schemas s where f.name in ('bbp', 'db_users', 'env', 'generate_series', 'storage', 'storagemodel', 'var') and f.type = %d and f.schema_id = s.id and s.name = 'sys');\n", F_UNION); if (schema) { 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 @@ -21,8 +21,28 @@ stdout of test 'upgrade` in directory 's Ready. Running database upgrade commands: set schema "sys"; +delete from _columns where table_id not in (select id from _tables); +insert into _columns values( (select max(id)+1 from _columns), 'system', 'boolean', 1, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='schemas'), NULL, true, 4, NULL); +insert into _columns values( (select max(id)+1 from _columns), 'varres', 'boolean', 1, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'), NULL, true, 7, NULL); +insert into _columns values( (select max(id)+1 from _columns), 'vararg', 'boolean', 1, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'), NULL, true, 8, NULL); +insert into _columns values( (select max(id)+1 from _columns), 'inout', 'tinyint', 8, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='args'), NULL, true, 6, NULL); +insert into _columns values( (select max(id)+1 from _columns), 'language', 'int', 32, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'), NULL, true, 9, NULL); +delete from _columns where table_id in (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions') and name='sql'; +update _columns set number='9' where name = 'schema_id' and table_id in (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'); +update _columns set number='7' where name = 'number' and table_id in (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='args'); +update _columns set number='4' where name = 'language' and table_id in (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'); delete from _columns where table_id in (select id from _tables where name like '#%'); delete from _tables where name like '#%'; +create table upgradeOct2014 as (select * from functions where type = 5 and language <> 0) with data; +create table upgradeOct2014_changes (c bigint); +create function drop_func_upgrade_oct2014( id integer ) returns int external name sql.drop_func_upgrade_oct2014; +insert into upgradeOct2014_changes select drop_func_upgrade_oct2014(id) from upgradeOct2014; +drop function drop_func_upgrade_oct2014; +create function create_func_upgrade_oct2014( f string ) returns int external name sql.create_func_upgrade_oct2014; +insert into upgradeOct2014_changes select create_func_upgrade_oct2014(func) from upgradeOct2014; +drop function create_func_upgrade_oct2014; +drop table upgradeOct2014_changes; +drop table upgradeOct2014; drop function sys.bbp; create function sys.bbp() returns table (id int, name string, htype string, ttype string, count BIGINT, refcnt int, lrefcnt int, location string, heat int, dirty string, status string, kind string) external name bbp.get; create schema json; @@ -149,7 +169,7 @@ create function sys.generate_series(firs returns table (value timestamp) external name generator.series; insert into sys.systemfunctions (select f.id from sys.functions f, sys.schemas s where f.name in ('hashsize', 'imprintsize', 'isauuid', 'md5', 'uuid') and f.type = 1 and f.schema_id = s.id and s.name = 'sys'); -insert into sys.systemfunctions (select f.id from sys.functions f, sys.schemas s where f.name in ('bbp', 'generate_series', 'storage', 'storagemodel') and f.type = 5 and f.schema_id = s.id and s.name = 'sys'); +insert into sys.systemfunctions (select f.id from sys.functions f, sys.schemas s where f.name in ('bbp', 'db_users', 'env', 'generate_series', 'storage', 'storagemodel', 'var') and f.type = 5 and f.schema_id = s.id and s.name = 'sys'); set schema "testschema"; #Interpreting bte as bit. 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,8 +18,28 @@ stdout of test 'upgrade` in directory 's Ready. Running database upgrade commands: set schema "sys"; +delete from _columns where table_id not in (select id from _tables); +insert into _columns values( (select max(id)+1 from _columns), 'system', 'boolean', 1, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='schemas'), NULL, true, 4, NULL); +insert into _columns values( (select max(id)+1 from _columns), 'varres', 'boolean', 1, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'), NULL, true, 7, NULL); +insert into _columns values( (select max(id)+1 from _columns), 'vararg', 'boolean', 1, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'), NULL, true, 8, NULL); +insert into _columns values( (select max(id)+1 from _columns), 'inout', 'tinyint', 8, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='args'), NULL, true, 6, NULL); +insert into _columns values( (select max(id)+1 from _columns), 'language', 'int', 32, 0, (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'), NULL, true, 9, NULL); +delete from _columns where table_id in (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions') and name='sql'; +update _columns set number='9' where name = 'schema_id' and table_id in (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'); +update _columns set number='7' where name = 'number' and table_id in (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='args'); +update _columns set number='4' where name = 'language' and table_id in (select _tables.id from _tables join schemas on _tables.schema_id=schemas.id where schemas.name='sys' and _tables.name='functions'); delete from _columns where table_id in (select id from _tables where name like '#%'); delete from _tables where name like '#%'; +create table upgradeOct2014 as (select * from functions where type = 5 and language <> 0) with data; +create table upgradeOct2014_changes (c bigint); +create function drop_func_upgrade_oct2014( id integer ) returns int external name sql.drop_func_upgrade_oct2014; +insert into upgradeOct2014_changes select drop_func_upgrade_oct2014(id) from upgradeOct2014; +drop function drop_func_upgrade_oct2014; +create function create_func_upgrade_oct2014( f string ) returns int external name sql.create_func_upgrade_oct2014; +insert into upgradeOct2014_changes select create_func_upgrade_oct2014(func) from upgradeOct2014; +drop function create_func_upgrade_oct2014; +drop table upgradeOct2014_changes; +drop table upgradeOct2014; drop function sys.bbp; create function sys.bbp() returns table (id int, name string, htype string, ttype string, count BIGINT, refcnt int, lrefcnt int, location string, heat int, dirty string, status string, kind string) external name bbp.get; create schema json; @@ -146,7 +166,7 @@ create function sys.generate_series(firs returns table (value timestamp) external name generator.series; insert into sys.systemfunctions (select f.id from sys.functions f, sys.schemas s where f.name in ('hashsize', 'imprintsize', 'isauuid', 'md5', 'uuid') and f.type = 1 and f.schema_id = s.id and s.name = 'sys'); -insert into sys.systemfunctions (select f.id from sys.functions f, sys.schemas s where f.name in ('bbp', 'generate_series', 'storage', 'storagemodel') and f.type = 5 and f.schema_id = s.id and s.name = 'sys'); +insert into sys.systemfunctions (select f.id from sys.functions f, sys.schemas s where f.name in ('bbp', 'db_users', 'env', 'generate_series', 'storage', 'storagemodel', 'var') and f.type = 5 and f.schema_id = s.id and s.name = 'sys'); set schema "testschema"; #Interpreting bte as bit. _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list