Changeset: 13256f288ffc for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=13256f288ffc
Modified Files:
monetdb5/optimizer/opt_wrapper.c
sql/backends/monet5/sql_upgrades.c
Branch: mtestplusplus
Log Message:
Merge with default.
diffs (76 lines):
diff --git a/monetdb5/optimizer/opt_wrapper.c b/monetdb5/optimizer/opt_wrapper.c
--- a/monetdb5/optimizer/opt_wrapper.c
+++ b/monetdb5/optimizer/opt_wrapper.c
@@ -104,8 +104,8 @@ str OPTwrapper (Client cntxt, MalBlkPtr
str msg = MAL_SUCCEED;
lng clk;
- if (cntxt->mode == FINISHCLIENT)
- throw(MAL, "optimizer", "prematurely stopped client");
+ if (cntxt->mode == FINISHCLIENT)
+ throw(MAL, "optimizer", "prematurely stopped client");
if( p == NULL)
throw(MAL, "opt_wrapper", "missing optimizer statement");
@@ -154,8 +154,7 @@ str OPTwrapper (Client cntxt, MalBlkPtr
if (codes[i].nme == 0)
throw(MAL, optimizer, "Optimizer implementation '%s' missing",
fcnnme);
- //OPTIMIZERDEBUG {
- {
+ OPTIMIZERDEBUG {
fprintf(stderr,"=FINISHED %s %d\n",optimizer, actions);
fprintFunction(stderr,mb,0,LIST_MAL_DEBUG );
}
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
@@ -1036,25 +1036,32 @@ sql_update_default_geom(Client c, mvc *s
}
static str
-sql_remove_environment_func(Client c)
+sql_remove_environment_func(Client c, mvc *sql)
{
+ sql_schema *s = NULL;
+ sql_table *t = NULL;
size_t bufsize = 1000, pos = 0;
char *buf = GDKmalloc(bufsize), *err = NULL;
if (buf== NULL)
throw(SQL, "sql_remove_environment_func", SQLSTATE(HY001)
MAL_MALLOC_FAIL);
+ /* because issueing sql: "drop view sys.environment cascade;" fails
with with error: !SQLException:sql.drop_view:42000!DROP VIEW: cannot drop
system view 'environment'
+ we need to drop the system view using internal function:
mvc_drop_table() */
+ s = mvc_bind_schema(sql, "sys");
+ t = mvc_bind_table(sql, s, "environment");
+ mvc_drop_table(sql, s, t, 1); // drop the system view:
sys.environment cascade
+
pos += snprintf(buf + pos, bufsize - pos,
- "drop view sys.environment cascade;\n"
- "drop function sys.environment() cascade\n"
+ "drop function sys.environment() cascade;\n"
"create view sys.environment as select * from
sys.env();\n"
"GRANT SELECT ON sys.environment TO PUBLIC;\n"
- "update sys._tables set system = true where name =
'environment' and schema_id in (select id from schemas where name = 'sys');\n");
+ "update sys._tables set system = true where system =
false and name = 'environment' and schema_id in (select id from schemas where
name = 'sys');\n");
pos += snprintf(buf + pos, bufsize - pos,
"delete from sys.systemfunctions where function_id not
in (select id from sys.functions);\n");
assert(pos < bufsize);
- printf("Running database upgrade commands:\n%s\n", buf);
+ printf("Running database upgrade commands:\ndrop view sys.environment
cascade;\n%s\n", buf);
err = SQLstatementIntern(c, &buf, "update", 1, 0, NULL);
GDKfree(buf);
return err; /* usually MAL_SUCCEED */
@@ -1176,8 +1183,8 @@ SQLupgrades(Client c, mvc *m)
}
}
- if (sql_bind_func(m->sa, s, "environment", NULL, NULL, F_FUNC)) {
- if ((err = sql_remove_environment_func(c)) != NULL) {
+ if (sql_bind_func_(m->sa, s, "environment", NULL, F_UNION)) {
+ if ((err = sql_remove_environment_func(c, m)) != NULL) {
fprintf(stderr, "!%s\n", err);
freeException(err);
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list