Changeset: a69d43ac03da for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a69d43ac03da
Modified Files:
sql/backends/monet5/sql_upgrades.c
sql/storage/store.c
Branch: Oct2020
Log Message:
Small bugfix, when dropping a SQL function, remove the respective arguments in
sys.args table
diffs (39 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
@@ -2395,6 +2395,9 @@ sql_update_oct2020(Client c, mvc *sql, c
"external name
sysmon.user_statistics;\n"
"update sys.functions set system = true
where system <> true and name = 'user_statistics' and schema_id = (select id
from sys.schemas where name = 'sys') and type = %d;\n", (int) F_UNION);
+ /* Remove entries on sys.args table without
correspondents on sys.functions table */
+ pos += snprintf(buf + pos, bufsize - pos,
+ "delete from sys.args where id in
(select args.id from sys.args left join sys.functions on args.func_id =
functions.id where functions.id is null);\n");
pos += snprintf(buf + pos, bufsize - pos, "set schema
\"%s\";\n", prev_schema);
assert(pos < bufsize);
diff --git a/sql/storage/store.c b/sql/storage/store.c
--- a/sql/storage/store.c
+++ b/sql/storage/store.c
@@ -5543,15 +5543,13 @@ sys_drop_func(sql_trans *tr, sql_func *f
oid rid_func = table_funcs.column_find_row(tr, sys_func_col,
&func->base.id, NULL);
if (is_oid_nil(rid_func))
return ;
- if (IS_AGGR(func)) {
- sql_table *sys_tab_args = find_sql_table(syss, "args");
- sql_column *sys_args_col = find_sql_column(sys_tab_args,
"func_id");
- rids *args = table_funcs.rids_select(tr, sys_args_col,
&func->base.id, &func->base.id, NULL);
-
- for (oid r = table_funcs.rids_next(args); !is_oid_nil(r); r =
table_funcs.rids_next(args))
- table_funcs.table_delete(tr, sys_tab_args, r);
- table_funcs.rids_destroy(args);
- }
+ sql_table *sys_tab_args = find_sql_table(syss, "args");
+ sql_column *sys_args_col = find_sql_column(sys_tab_args, "func_id");
+ rids *args = table_funcs.rids_select(tr, sys_args_col, &func->base.id,
&func->base.id, NULL);
+
+ for (oid r = table_funcs.rids_next(args); !is_oid_nil(r); r =
table_funcs.rids_next(args))
+ table_funcs.table_delete(tr, sys_tab_args, r);
+ table_funcs.rids_destroy(args);
assert(!is_oid_nil(rid_func));
table_funcs.table_delete(tr, sys_tab_func, rid_func);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list