Changeset: c645018726e3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c645018726e3 Modified Files: sql/backends/monet5/sql_upgrades.c sql/scripts/97_comments.sql sql/server/sql_mvc.c sql/server/sql_privileges.c sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.32bit sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 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: Mar2018 Log Message:
Move creation of sys.comments table to C. It's a core table, it should be created by the core. diffs (truncated from 395 to 300 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 @@ -975,6 +975,21 @@ sql_update_mar2018(Client c, mvc *sql) throw(SQL, "sql_update_mar2018", SQLSTATE(HY001) MAL_MALLOC_FAIL); s = mvc_bind_schema(sql, "sys"); + t = mvc_create_table(sql, s, "comments", tt_table, 1, SQL_PERSIST, 0, -1); + sql_column *col = mvc_create_column_(sql, t, "id", "int", 32); + sql_key *k = sql_trans_create_ukey(sql->session->tr, t, "comments_id_pkey", pkey); + k = sql_trans_create_kc(sql->session->tr, k, col); + k = sql_trans_key_done(sql->session->tr, k); + sql_trans_create_dependency(sql->session->tr, col->base.id, k->idx->base.id, INDEX_DEPENDENCY); + col = mvc_create_column_(sql, t, "remark", "varchar", 65000); + sql_trans_alter_null(sql->session->tr, col, 0); + + sql_table *privs = mvc_bind_table(sql, s, "privileges"); + int pub = ROLE_PUBLIC; + int p = PRIV_SELECT; + int zero = 0; + table_funcs.table_insert(sql->session->tr, privs, &t->base.id, &pub, &p, &zero, &zero); + pos += snprintf(buf + pos, bufsize - pos, "set schema \"sys\";\n"); /* 21_dependency_views.sql */ @@ -1406,11 +1421,6 @@ sql_update_mar2018(Client c, mvc *sql) /* 97_comments */ pos += snprintf(buf + pos, bufsize - pos, - "CREATE TABLE sys.comments (\n" - " id INTEGER NOT NULL PRIMARY KEY,\n" - " remark VARCHAR(65000) NOT NULL\n" - ");\n" - "GRANT SELECT ON sys.comments TO PUBLIC;\n" "CREATE FUNCTION sys.function_type_keyword(ftype INT)\n" "RETURNS VARCHAR(20)\n" "BEGIN\n" diff --git a/sql/scripts/97_comments.sql b/sql/scripts/97_comments.sql --- a/sql/scripts/97_comments.sql +++ b/sql/scripts/97_comments.sql @@ -4,13 +4,6 @@ -- -- Copyright 1997 - July 2008 CWI, August 2008 - 2018 MonetDB B.V. -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; - - -- This table used to be in 99_system.sql but we need the systemfunctions table -- in sys.describe_all_objects and sys.commented_function_signatures defined below. CREATE TABLE sys.systemfunctions (function_id INTEGER NOT NULL); diff --git a/sql/server/sql_mvc.c b/sql/server/sql_mvc.c --- a/sql/server/sql_mvc.c +++ b/sql/server/sql_mvc.c @@ -158,8 +158,18 @@ mvc_init(int debug, store_type store, in while ((rid = table_funcs.column_find_row(m->session->tr, depids, &cid, NULL)), !is_oid_nil(rid)) { table_funcs.column_update_value(m->session->tr, depids, rid, &ncid); } - } else { + } else { + sql_column *col; + sql_key *k; sql_create_env(m, s); + t = mvc_create_table(m, s, "comments", tt_table, 1, SQL_PERSIST, 0, -1); + col = mvc_create_column_(m, t, "id", "int", 32); + k = sql_trans_create_ukey(m->session->tr, t, "comments_id_pkey", pkey); + k = sql_trans_create_kc(m->session->tr, k, col); + k = sql_trans_key_done(m->session->tr, k); + sql_trans_create_dependency(m->session->tr, col->base.id, k->idx->base.id, INDEX_DEPENDENCY); + col = mvc_create_column_(m, t, "remark", "varchar", 65000); + sql_trans_alter_null(m->session->tr, col, 0); sql_create_privileges(m, s); } diff --git a/sql/server/sql_privileges.c b/sql/server/sql_privileges.c --- a/sql/server/sql_privileges.c +++ b/sql/server/sql_privileges.c @@ -877,6 +877,8 @@ sql_create_privileges(mvc *m, sql_schema table_funcs.table_insert(m->session->tr, privs, &t->base.id, &pub, &p, &zero, &zero); t = find_sql_table(s, "columns"); table_funcs.table_insert(m->session->tr, privs, &t->base.id, &pub, &p, &zero, &zero); + t = find_sql_table(s, "comments"); + table_funcs.table_insert(m->session->tr, privs, &t->base.id, &pub, &p, &zero, &zero); t = find_sql_table(s, "user_role"); table_funcs.table_insert(m->session->tr, privs, &t->base.id, &pub, &p, &zero, &zero); t = find_sql_table(s, "auths"); diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 --- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 +++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 @@ -5720,11 +5720,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64 b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64 --- a/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64 +++ b/sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.powerpc64 @@ -5715,11 +5715,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out @@ -5007,11 +5007,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.32bit @@ -5007,11 +5007,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 @@ -5770,11 +5770,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64 b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64 --- a/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64 +++ b/sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.powerpc64 @@ -5770,11 +5770,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 b/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 --- a/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 +++ b/sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 @@ -5720,11 +5720,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out --- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out +++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out @@ -5007,11 +5007,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit --- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit +++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.32bit @@ -5007,11 +5007,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 --- a/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 +++ b/sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 @@ -5770,11 +5770,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN diff --git a/sql/test/emptydb/Tests/check.stable.out b/sql/test/emptydb/Tests/check.stable.out --- a/sql/test/emptydb/Tests/check.stable.out +++ b/sql/test/emptydb/Tests/check.stable.out @@ -4638,7 +4638,7 @@ drop function pcre_replace(string, strin [ "auths", "public", "SELECT", NULL, 0 ] [ "columns", "public", "SELECT", NULL, 0 ] [ "commented_function_signatures", "public", "SELECT", "monetdb", 0 ] -[ "comments", "public", "SELECT", "monetdb", 0 ] +[ "comments", "public", "SELECT", NULL, 0 ] [ "dependencies", "public", "SELECT", NULL, 0 ] [ "dependencies_vw", "public", "SELECT", "monetdb", 0 ] [ "dependency_args_on_types", "public", "SELECT", "monetdb", 0 ] diff --git a/sql/test/emptydb/Tests/check.stable.out.32bit b/sql/test/emptydb/Tests/check.stable.out.32bit --- a/sql/test/emptydb/Tests/check.stable.out.32bit +++ b/sql/test/emptydb/Tests/check.stable.out.32bit @@ -4642,7 +4642,7 @@ drop function pcre_replace(string, strin [ "auths", "public", "SELECT", NULL, 0 ] [ "columns", "public", "SELECT", NULL, 0 ] [ "commented_function_signatures", "public", "SELECT", "monetdb", 0 ] -[ "comments", "public", "SELECT", "monetdb", 0 ] +[ "comments", "public", "SELECT", NULL, 0 ] [ "dependencies", "public", "SELECT", NULL, 0 ] [ "dependencies_vw", "public", "SELECT", "monetdb", 0 ] [ "dependency_args_on_types", "public", "SELECT", "monetdb", 0 ] diff --git a/sql/test/emptydb/Tests/check.stable.out.int128 b/sql/test/emptydb/Tests/check.stable.out.int128 --- a/sql/test/emptydb/Tests/check.stable.out.int128 +++ b/sql/test/emptydb/Tests/check.stable.out.int128 @@ -4839,7 +4839,7 @@ drop function pcre_replace(string, strin [ "auths", "public", "SELECT", NULL, 0 ] [ "columns", "public", "SELECT", NULL, 0 ] [ "commented_function_signatures", "public", "SELECT", "monetdb", 0 ] -[ "comments", "public", "SELECT", "monetdb", 0 ] +[ "comments", "public", "SELECT", NULL, 0 ] [ "dependencies", "public", "SELECT", NULL, 0 ] [ "dependencies_vw", "public", "SELECT", "monetdb", 0 ] [ "dependency_args_on_types", "public", "SELECT", "monetdb", 0 ] diff --git a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 --- a/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 +++ b/sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 @@ -5718,11 +5718,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL -); -GRANT SELECT ON sys.comments TO PUBLIC; CREATE FUNCTION sys.function_type_keyword(ftype INT) RETURNS VARCHAR(20) BEGIN 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 @@ -5002,11 +5002,6 @@ external name wlr."getreplicaclock"; create function replicaTick() returns bigint external name wlr."getreplicatick"; insert into sys.systemfunctions (select id from sys.functions where name in ('master', 'stopmaster', 'masterbeat', 'masterclock', 'mastertick', 'replicate', 'replicabeat', 'replicaclock', 'replicatick') and schema_id = (select id from sys.schemas where name = 'sys') and id not in (select function_id from sys.systemfunctions)); -CREATE TABLE sys.comments ( - id INTEGER NOT NULL PRIMARY KEY, - remark VARCHAR(65000) NOT NULL _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list