Changeset: 0931e70a1015 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0931e70a1015
Modified Files:
sql/backends/monet5/sql_upgrades.c
Branch: Jul2017
Log Message:
Remove Jul2017 upgrade code from Dec2016 upgrade function.
It got there accidentally.
diffs (142 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
@@ -609,7 +609,7 @@ sql_update_geom(Client c, mvc *sql, int
static str
sql_update_dec2016(Client c, mvc *sql)
{
- size_t bufsize = 12240, pos = 0;
+ size_t bufsize = 10240, pos = 0;
char *buf = GDKmalloc(bufsize), *err = NULL;
char *schema = stack_get_string(sql, "current_schema");
sql_schema *s;
@@ -645,48 +645,6 @@ sql_update_dec2016(Client c, mvc *sql)
"drop function sys.zorder_decode_x;\n"
"drop function sys.zorder_encode;\n");
- /* 46_profiler */
- pos += snprintf(buf+pos, bufsize - pos,
- "create function profiler.getprofilerlimit() returns
integer external name profiler.getprofilerlimit;\n"
- "create procedure profiler.setprofilerlimit(lim
integer) external name profiler.setprofilerlimit;\n");
-
- /* 51_sys_schema_extension */
- pos += snprintf(buf+pos, bufsize - pos,
- "CREATE TABLE sys.function_types (\n"
- " function_type_id SMALLINT NOT NULL PRIMARY
KEY,\n"
- " function_type_name VARCHAR(30) NOT NULL UNIQUE);\n"
- "INSERT INTO sys.function_types (function_type_id,
function_type_name) VALUES\n"
- " (1, 'Scalar function'), (2, 'Procedure'), (3,
'Aggregate function'), (4, 'Filter function'), (5, 'Function returning a
table'),\n"
- " (6, 'Analytic function'), (7, 'Loader function');\n"
-
- "CREATE TABLE sys.function_languages (\n"
- " language_id SMALLINT NOT NULL PRIMARY KEY,\n"
- " language_name VARCHAR(20) NOT NULL UNIQUE);\n"
- "INSERT INTO sys.function_languages (language_id,
language_name) VALUES\n"
- " (0, 'Internal C'), (1, 'MAL'), (2, 'SQL'), (3, 'R'),
(4, 'C'), (5, 'Java'), (6, 'Python'), (7, 'Python Mapped');\n"
-
- "CREATE TABLE sys.key_types (\n"
- " key_type_id SMALLINT NOT NULL PRIMARY KEY,\n"
- " key_type_name VARCHAR(15) NOT NULL UNIQUE);\n"
- "INSERT INTO sys.key_types (key_type_id, key_type_name)
VALUES\n"
- " (0, 'Primary Key'), (1, 'Unique Key'), (2, 'Foreign
Key');\n"
-
- "CREATE TABLE sys.index_types (\n"
- " index_type_id SMALLINT NOT NULL PRIMARY KEY,\n"
- " index_type_name VARCHAR(25) NOT NULL UNIQUE);\n"
- "INSERT INTO sys.index_types (index_type_id,
index_type_name) VALUES\n"
- " (0, 'Hash'), (1, 'Join'), (2, 'Order preserving
hash'), (3, 'No-index'), (4, 'Imprint'), (5, 'Ordered');\n"
-
- "CREATE TABLE sys.privilege_codes (\n"
- " privilege_code_id INT NOT NULL PRIMARY KEY,\n"
- " privilege_code_name VARCHAR(30) NOT NULL
UNIQUE);\n"
- "INSERT INTO sys.privilege_codes (privilege_code_id,
privilege_code_name) VALUES\n"
- " (1, 'SELECT'), (2, 'UPDATE'), (4, 'INSERT'), (8,
'DELETE'), (16, 'EXECUTE'), (32, 'GRANT'),\n"
- " -- next are combined privileges applicable only to
tables and columns\n"
- " (3, 'SELECT,UPDATE'), (5, 'SELECT,INSERT'), (6,
'INSERT,UPDATE'), (7, 'SELECT,INSERT,UPDATE'),\n"
- " (9, 'SELECT,DELETE'), (10, 'UPDATE,DELETE'), (11,
'SELECT,UPDATE,DELETE'), (12, 'INSERT,DELETE'),\n"
- " (13, 'SELECT,INSERT,DELETE'), (14,
'INSERT,UPDATE,DELETE'), (15, 'SELECT,INSERT,UPDATE,DELETE');\n");
-
/* 75_storagemodel.sql */
pos += snprintf(buf + pos, bufsize - pos,
"drop view sys.tablestoragemodel;\n"
@@ -853,12 +811,6 @@ sql_update_dec2016(Client c, mvc *sql)
"insert into sys.systemfunctions (select f.id from
sys.functions f, sys.schemas s where f.name in ('createorderindex',
'droporderindex', 'storagemodelinit') and f.type = %d and f.schema_id = s.id
and s.name = 'sys');\n",
F_PROC);
pos += snprintf(buf + pos, bufsize - pos,
- "insert into sys.systemfunctions (select f.id from
sys.functions f, sys.schemas s where f.name in ('getprofilerlimit') and f.type
= %d and f.schema_id = s.id and s.name = 'profiler');\n",
- 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 ('setprofilerlimit') and f.type
= %d and f.schema_id = s.id and s.name = 'profiler');\n",
- F_PROC);
- pos += snprintf(buf + pos, bufsize - pos,
"delete from systemfunctions where function_id not in
(select id from functions);\n");
if (schema)
@@ -1380,6 +1332,33 @@ sql_update_dec2016_sp2(Client c, mvc *sq
}
static str
+sql_update_dec2016_sp3(Client c, mvc *sql)
+{
+ size_t bufsize = 2048, pos = 0;
+ char *buf = GDKmalloc(bufsize), *err = NULL;
+ char *schema = stack_get_string(sql, "current_schema");
+
+ pos += snprintf(buf + pos, bufsize - pos,
+ "set schema \"sys\";\n"
+ "drop procedure sys.settimeout(bigint);\n"
+ "drop procedure sys.settimeout(bigint,bigint);\n"
+ "drop procedure sys.setsession(bigint);\n"
+ "create procedure sys.settimeout(\"query\" bigint)
external name clients.settimeout;\n"
+ "create procedure sys.settimeout(\"query\" bigint,
\"session\" bigint) external name clients.settimeout;\n"
+ "create procedure sys.setsession(\"timeout\" bigint)
external name clients.setsession;\n"
+ "insert into sys.systemfunctions (select id from
sys.functions where name in ('settimeout', 'setsession') and schema_id =
(select id from sys.schemas where name = 'sys') and id not in (select
function_id from sys.systemfunctions));\n"
+ "delete from systemfunctions where function_id not in
(select id from functions);\n");
+ if (schema)
+ pos += snprintf(buf + pos, bufsize - pos, "set schema
\"%s\";\n", schema);
+ assert(pos < bufsize);
+
+ printf("Running database upgrade commands:\n%s\n", buf);
+ err = SQLstatementIntern(c, &buf, "update", 1, 0, NULL);
+ GDKfree(buf);
+ return err; /* usually MAL_SUCCEED */
+}
+
+static str
sql_update_jul2017(Client c, mvc *sql)
{
size_t bufsize = 10000, pos = 0;
@@ -1497,33 +1476,6 @@ sql_update_jul2017(Client c, mvc *sql)
return err; /* usually MAL_SUCCEED */
}
-static str
-sql_update_dec2016_sp3(Client c, mvc *sql)
-{
- size_t bufsize = 2048, pos = 0;
- char *buf = GDKmalloc(bufsize), *err = NULL;
- char *schema = stack_get_string(sql, "current_schema");
-
- pos += snprintf(buf + pos, bufsize - pos,
- "set schema \"sys\";\n"
- "drop procedure sys.settimeout(bigint);\n"
- "drop procedure sys.settimeout(bigint,bigint);\n"
- "drop procedure sys.setsession(bigint);\n"
- "create procedure sys.settimeout(\"query\" bigint)
external name clients.settimeout;\n"
- "create procedure sys.settimeout(\"query\" bigint,
\"session\" bigint) external name clients.settimeout;\n"
- "create procedure sys.setsession(\"timeout\" bigint)
external name clients.setsession;\n"
- "insert into sys.systemfunctions (select id from
sys.functions where name in ('settimeout', 'setsession') and schema_id =
(select id from sys.schemas where name = 'sys') and id not in (select
function_id from sys.systemfunctions));\n"
- "delete from systemfunctions where function_id not in
(select id from functions);\n");
- if (schema)
- pos += snprintf(buf + pos, bufsize - pos, "set schema
\"%s\";\n", schema);
- assert(pos < bufsize);
-
- printf("Running database upgrade commands:\n%s\n", buf);
- err = SQLstatementIntern(c, &buf, "update", 1, 0, NULL);
- GDKfree(buf);
- return err; /* usually MAL_SUCCEED */
-}
-
void
SQLupgrades(Client c, mvc *m)
{
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list