Changeset: 03d3bd0645a3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/03d3bd0645a3
Modified Files:
sql/server/rel_psm.c
sql/server/rel_schema.c
Branch: privfuncs
Log Message:
Missing errors while attempting to replace system functions/views
diffs (36 lines):
diff --git a/sql/server/rel_psm.c b/sql/server/rel_psm.c
--- a/sql/server/rel_psm.c
+++ b/sql/server/rel_psm.c
@@ -861,6 +861,9 @@ rel_create_func(sql_query *query, dlist
} else if (!replace) {
list_destroy(type_list);
return sql_error(sql, 02, SQLSTATE(42000) "CREATE %s:
name '%s' already in use", F, fname);
+ } else if (replace && !sf->func->s) {
+ list_destroy(type_list);
+ return sql_error(sql, 02, SQLSTATE(42000) "CREATE %s:
cannot replace system function '%s'", F, fname);
}
} else {
sql->session->status = 0; /* if the function was not found
clean the error */
@@ -871,6 +874,8 @@ rel_create_func(sql_query *query, dlist
sql_subfunc *found = NULL;
if ((found = sql_bind_func_(sql, s->base.name, fname,
type_list, (type == F_FUNC || type == F_FILT) ? F_AGGR : F_FUNC, true))) {
list_destroy(type_list);
+ if (found->func->private) /* cannot create a function
using a private name or replace a existing one */
+ return sql_error(sql, 02, SQLSTATE(42000)
"CREATE %s: name '%s' cannot be used", F, fname);
return sql_error(sql, 02, SQLSTATE(42000) "CREATE %s:
there's %s with the name '%s' and the same parameters, which causes ambiguous
calls", F,
IS_AGGR(found->func) ?
"an aggregate" : IS_FILT(found->func) ? "a filter function" : "a function",
fname);
}
diff --git a/sql/server/rel_schema.c b/sql/server/rel_schema.c
--- a/sql/server/rel_schema.c
+++ b/sql/server/rel_schema.c
@@ -1420,6 +1420,10 @@ rel_create_view(sql_query *query, dlist
if (create && (t = mvc_bind_table(sql, s, name))) {
if (!replace)
return sql_error(sql, 02, SQLSTATE(42S01) "%s: name
'%s' already in use", base, name);
+ if (!isView(t))
+ return sql_error(sql, 02, SQLSTATE(42000) "%s: '%s' is
not a view", base, name);
+ if (t->system)
+ return sql_error(sql, 02, SQLSTATE(42000) "%s: cannot
replace system view '%s'", base, name);
foundid = t->base.id; /* when recreating a view, the view
itself can't be found */
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]