Changeset: 554094b17627 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=554094b17627 Modified Files: sql/backends/monet5/sql_upgrades.c Branch: Apr2019 Log Message:
Extended upgrade program with removal of system function prod(decimal) from sys.functions and sys.args. diffs (59 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 @@ -1948,6 +1948,45 @@ sql_update_apr2019_sp1(Client c) return err; /* usually MAL_SUCCEED */ } +static str +sql_update_apr2019_sp2(Client c) +{ + /* Determine if system function sys.prod(decimal) exists in sys.functions, if so remove them. + * see also https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f93d5290abe4 + */ + char *err = NULL; + char *qry = "select f.id from sys.functions f where f.name = 'prod' and func = 'prod'" + " and mod in ('sql', 'aggr') and language = 0 and f.type in (3,6) and f.system" + " and schema_id in (select s.id from sys.schemas s where s.name = 'sys')" + " and f.id in (select a.func_id from sys.args a where a.type = 'decimal'" + " and type_digits in (2,4,9,18,38) and a.name in ('arg','arg_1') and inout = 1 and number = 1);"; + res_table *output = NULL; + + err = SQLstatementIntern(c, &qry, "update", true, false, &output); + if (err == NULL) { + BAT *b = BATdescriptor(output->cols[0].b); + if (b) { + if (BATcount(b) > 0) { + /* found entries, we need to remove them sys.functions and sys.args */ + char *upd = "delete from sys.functions f where f.name = 'prod' and func = 'prod'" + " and mod in ('sql', 'aggr') and language = 0 and f.type in (3,6) and f.system" + " and schema_id in (select s.id from sys.schemas s where s.name = 'sys')" + " and f.id in (select a.func_id from sys.args a where a.type = 'decimal'" + " and type_digits in (2,4,9,18,38) and a.name in ('arg','arg_1') and inout = 1 and number = 1);\n" + "delete from sys.args where func_id not in (select id from sys.functions);\n"; + + printf("Running database upgrade commands:\n%s\n", upd); + err = SQLstatementIntern(c, &upd, "update", true, false, NULL); + } + BBPunfix(b->batCacheid); + } + } + if (output != NULL) + res_tables_destroy(output); + + return err; /* usually MAL_SUCCEED */ +} + void SQLupgrades(Client c, mvc *m) { @@ -2162,4 +2201,9 @@ SQLupgrades(Client c, mvc *m) fprintf(stderr, "!%s\n", err); freeException(err); } + + if ((err = sql_update_apr2019_sp2(c)) != NULL) { + fprintf(stderr, "!%s\n", err); + freeException(err); + } } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list