Changeset: 918646536161 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=918646536161
Modified Files:
sql/src/backends/monet5/sql_gencode.mx
sql/src/server/sql_psm.mx
Branch: Oct2010
Log Message:
only 'real' create func/aggr etc change the schema's
diffs (62 lines):
diff -r dd7bd8c7a3de -r 918646536161 sql/src/backends/monet5/sql_gencode.mx
--- a/sql/src/backends/monet5/sql_gencode.mx Wed Nov 10 10:21:08 2010 +0100
+++ b/sql/src/backends/monet5/sql_gencode.mx Wed Nov 10 12:01:57 2010 +0100
@@ -2318,19 +2318,22 @@
Symbol backup = NULL;
stmt *s;
int i, retseen =0, sideeffects =0;
- sql_allocator *sa = sa_create(); /* NIELS: leaks, will be
resolved once we keep rel,sa,mb (for recompiles) */
+ sql_allocator *sa, *osa = m->sa;
/* nothing to do for internal and ready (not recompiling) functions */
if (!f->sql || f->sql > 1)
return;
f->sql++;
+ sa = sa_create();
s = sql_parse(m, sa, f->imp, m_instantiate);
if (!s) {
fputs(m->errstr, stderr);
+ sa_destroy(sa);
return;
} else {
stmt *opt;
+ m->sa = sa;
opt = rel2bin(m, s);
stmt_destroy(s);
s = bin_optimizer(m, opt);
@@ -2400,6 +2403,11 @@
/* SQL function definitions meant for inlineing should not be optimized
before */
varSetProp(curBlk, getArg(curInstr, 0), sqlfunctionProp, op_eq, NULL);
stmt_destroy(s);
+ /* Because types (tables) are allocated using the sql-allocator, we
+ cannot destroy it here "LEAKS"
+ sa_destroy(sa);
+ */
+ m->sa = osa;
addQueryToCache(c);
if (backup)
c->curprg = backup;
diff -r dd7bd8c7a3de -r 918646536161 sql/src/server/sql_psm.mx
--- a/sql/src/server/sql_psm.mx Wed Nov 10 10:21:08 2010 +0100
+++ b/sql/src/server/sql_psm.mx Wed Nov 10 12:01:57 2010 +0100
@@ -536,6 +536,9 @@
int create = (!instantiate && !deps);
char *F = is_aggr?"AGGREGATE":(is_func?"FUNCTION":"PROCEDURE");
+ if (STORE_READONLY(active_store_type) && create)
+ return sql_error(sql, 06, "schema statements cannot be executed
on a readonly database.");
+
if (sname && !(s = mvc_bind_schema(sql, sname)))
return sql_error(sql, 02, "CREATE %s: no such schema '%s'", F,
sname);
if (s == NULL)
@@ -798,9 +801,6 @@
int is_func = (s->token == SQL_CREATE_FUNC);
int is_aggr = (s->token == SQL_CREATE_AGGR);
- if (STORE_READONLY(active_store_type))
- return sql_error(sql, 06, "schema statements cannot be
executed on a readonly database.");
-
ret = create_func(sql, l->h->data.lval, l->h->next->data.lval,
l->h->next->next->data.sym, l->h->next->next->next->data.lval,
l->h->next->next->next->next->data.lval, is_func, is_aggr);
sql->type = Q_SCHEMA;
} break;
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list