Changeset: 700f078e3671 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/700f078e3671 Modified Files: sql/backends/monet5/sql_upgrades.c sql/storage/bat/bat_storage.c sql/storage/store.c sql/test/emptydb/Tests/check.stable.out Branch: default Log Message:
Merge with Sep2022 branch. diffs (truncated from 3816 to 300 lines): diff --git a/clients/ChangeLog.Sep2022 b/clients/ChangeLog.Sep2022 --- a/clients/ChangeLog.Sep2022 +++ b/clients/ChangeLog.Sep2022 @@ -1,3 +1,7 @@ # ChangeLog file for clients # This file is updated with Maddlog +* Wed Sep 21 2022 Sjoerd Mullender <sjo...@acm.org> +- Dumping of function GRANTs was improved by adding the types of the + function (and procedure) arguments. + diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -2611,24 +2611,42 @@ dump_database(Mapi mid, stream *toConsol "AND p.grantable = go.id " "ORDER BY s.name, t.name, c.name, a.name, g.name, p.grantable"; const char *function_grants = - "SELECT s.name, f.name, a.name, " - "pc.privilege_code_name, " - "g.name, go.opt, " - "ft.function_type_keyword " - "FROM sys.schemas s, sys.functions f, " - "sys.auths a, sys.privileges p, sys.auths g, " - "sys.function_types ft, " - "sys.privilege_codes pc, " - "(VALUES (0, ''), (1, ' WITH GRANT OPTION')) AS go (id, opt) " - "WHERE s.id = f.schema_id " + "SELECT f.id, " + "s.name, " + "f.name, " + "a.type, " + "a.type_digits, " + "a.type_scale, " + "a.inout, " + "a.number, " + "au.name, " + "pc.privilege_code_name, " + "go.opt, " + "ft.function_type_keyword " + "FROM sys.schemas s, " + "sys.functions f LEFT OUTER JOIN sys.args a ON f.id = a.func_id, " + "sys.auths au, " + "sys.privileges p, " + "sys.auths g, " + "sys.function_types ft, " + "sys.privilege_codes pc, " + "(VALUES (0, ''), (1, ' WITH GRANT OPTION')) AS go (id, opt) " + "WHERE NOT f.system " + "AND s.id = f.schema_id " "AND f.id = p.obj_id " - "AND p.auth_id = a.id " + "AND p.auth_id = au.id " "AND p.grantor = g.id " "AND p.privileges = pc.privilege_code_id " "AND f.type = ft.function_type_id " - "AND NOT f.system " "AND p.grantable = go.id " - "ORDER BY s.name, f.name, a.name, g.name, p.grantable"; + "ORDER BY s.name, " + "f.name, " + "au.name, " + "g.name, " + "p.grantable, " + "f.id, " + "a.inout DESC, " + "a.number"; const char *global_grants = "SELECT a.name, pc.grnt, g.name, go.opt " "FROM sys.privileges p, " @@ -2758,6 +2776,9 @@ dump_database(Mapi mid, stream *toConsol char *curschema = NULL; MapiHdl hdl = NULL; int rc = 0; + int lastfid = 0; + const char *sep; + bool hashge = has_hugeint(mid); /* start a transaction for the dump */ mnstr_printf(toConsole, "%s;\n", start_trx); @@ -3269,7 +3290,7 @@ dump_database(Mapi mid, stream *toConsol if (priv == 79) { mnstr_printf(toConsole, " ALL PRIVILEGES"); } else { - const char *sep = ""; + sep = ""; if (priv & 1) { mnstr_printf(toConsole, "%s SELECT", sep); @@ -3327,7 +3348,11 @@ dump_database(Mapi mid, stream *toConsol dquoted_print(toConsole, cname, ") ON "); dquoted_print(toConsole, schema, "."); dquoted_print(toConsole, tname, " TO "); - dquoted_print(toConsole, aname, grantable); + if (strcmp(aname, "public") == 0) { + mnstr_printf(toConsole, "PUBLIC%s", grantable); + } else { + dquoted_print(toConsole, aname, grantable); + } mnstr_printf(toConsole, ";\n"); } if (mapi_error(mid)) @@ -3338,21 +3363,44 @@ dump_database(Mapi mid, stream *toConsol mapi_error(mid)) goto bailout; + sep = ""; while (mapi_fetch_row(hdl) != 0) { - const char *schema = mapi_fetch_field(hdl, 0); - const char *fname = mapi_fetch_field(hdl, 1); - const char *aname = mapi_fetch_field(hdl, 2); - const char *priv = mapi_fetch_field(hdl, 3); - const char *grantable = mapi_fetch_field(hdl, 5); - const char *ftype = mapi_fetch_field(hdl, 6); + const char *fid = mapi_fetch_field(hdl, 0); + const char *schema = mapi_fetch_field(hdl, 1); + const char *fname = mapi_fetch_field(hdl, 2); + const char *argtype = mapi_fetch_field(hdl, 3); + const char *argdigits = mapi_fetch_field(hdl, 4); + const char *argscale = mapi_fetch_field(hdl, 5); + const char *arginout = mapi_fetch_field(hdl, 6); + const char *argnumber = mapi_fetch_field(hdl, 7); + const char *aname = mapi_fetch_field(hdl, 8); + const char *priv = mapi_fetch_field(hdl, 9); + const char *grantable = mapi_fetch_field(hdl, 10); + const char *ftype = mapi_fetch_field(hdl, 11); if (sname != NULL && strcmp(schema, sname) != 0) continue; - mnstr_printf(toConsole, "GRANT %s ON %s ", priv, ftype); - dquoted_print(toConsole, schema, "."); - dquoted_print(toConsole, fname, " TO "); - dquoted_print(toConsole, aname, grantable); - mnstr_printf(toConsole, ";\n"); + int thisfid = atoi(fid); + if (lastfid != thisfid) { + lastfid = thisfid; + sep = ""; + mnstr_printf(toConsole, "GRANT %s ON %s ", priv, ftype); + dquoted_print(toConsole, schema, "."); + dquoted_print(toConsole, fname, "("); + } + if (arginout != NULL && strcmp(arginout, "1") == 0) { + mnstr_printf(toConsole, "%s", sep); + dump_type(mid, toConsole, argtype, argdigits, argscale, hashge); + sep = ", "; + } else if (argnumber == NULL || strcmp(argnumber, "0") == 0) { + mnstr_printf(toConsole, ") TO "); + if (strcmp(aname, "public") == 0) { + mnstr_printf(toConsole, "PUBLIC%s", grantable); + } else { + dquoted_print(toConsole, aname, grantable); + } + mnstr_printf(toConsole, ";\n"); + } } if (mapi_error(mid)) goto bailout; diff --git a/gdk/ChangeLog.Jan2022 b/gdk/ChangeLog.Jan2022 new file mode 100644 --- /dev/null +++ b/gdk/ChangeLog.Jan2022 @@ -0,0 +1,11 @@ +# ChangeLog file for GDK +# This file is updated with Maddlog + +* Mon Sep 19 2022 Sjoerd Mullender <sjo...@acm.org> +- Fixed a bug in ORDER BY with both NULLS LAST and LIMIT when the ordering + was on an interger or integer-like column and NULL values are present. + +* Wed Aug 24 2022 Sjoerd Mullender <sjo...@acm.org> +- The median_avg and quantile_avg returned bogus results in the + non-grouped case (i.e. something like SELECT sys.median_avg(i) FROM t). + diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c --- a/gdk/gdk_logger.c +++ b/gdk/gdk_logger.c @@ -3114,7 +3114,7 @@ log_tstart(logger *lg, bool flushnow, ul { MT_lock_set(&lg->rotation_lock); log_lock(lg); - if (flushnow || lg->request_rotation) { + if (flushnow || (lg->request_rotation && ATOMIC_GET(&lg->refcount) == 0)) { lg->id++; log_close_output(lg); /* start new file */ diff --git a/monetdb5/mal/Tests/tst163.maltest b/monetdb5/mal/Tests/tst163.maltest --- a/monetdb5/mal/Tests/tst163.maltest +++ b/monetdb5/mal/Tests/tst163.maltest @@ -19,3 +19,4 @@ statement error io.print(j) ---- nil + diff --git a/sql/ChangeLog.Jan2022 b/sql/ChangeLog.Jan2022 new file mode 100644 --- /dev/null +++ b/sql/ChangeLog.Jan2022 @@ -0,0 +1,7 @@ +# ChangeLog file for sql +# This file is updated with Maddlog + +* Mon Sep 19 2022 Sjoerd Mullender <sjo...@acm.org> +- Fixed a bug in COPY BINARY INTO where the input wasn't checked + thoroughly enough. + diff --git a/sql/ChangeLog.Sep2022 b/sql/ChangeLog.Sep2022 --- a/sql/ChangeLog.Sep2022 +++ b/sql/ChangeLog.Sep2022 @@ -1,3 +1,8 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Wed Sep 21 2022 Sjoerd Mullender <sjo...@acm.org> +- The function sys.tracelog is now executable by anyone. The function + (and view of the same name) returns the tracing information of a query + that was prepended with the TRACE keyword. + diff --git a/sql/backends/monet5/Tests/simpleSQL.maltest b/sql/backends/monet5/Tests/simpleSQL.maltest --- a/sql/backends/monet5/Tests/simpleSQL.maltest +++ b/sql/backends/monet5/Tests/simpleSQL.maltest @@ -20,4 +20,3 @@ user.foo() % 1 # length 1 - diff --git a/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test b/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test --- a/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test +++ b/sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.test @@ -58,7 +58,6 @@ SELECT pyapi_timestamp(d) FROM timestamp ---- 2000-01-01 12:00:00.000001 - statement ok CREATE TABLE decimal_table(d DECIMAL(10, 3)) 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 @@ -4673,8 +4673,10 @@ sql_update_sep2022(Client c, mvc *sql) } res_table_destroy(output); output = NULL; - if (err != MAL_SUCCEED) + if (err != MAL_SUCCEED) { + GDKfree(buf); return err; + } /* if 'describe_partition_tables' system view doesn't use 'vals' * CTE, re-create it; while we're at it, also update the sequence @@ -5005,8 +5007,10 @@ sql_update_sep2022(Client c, mvc *sql) } res_table_destroy(output); output = NULL; - if (err != MAL_SUCCEED) + if (err != MAL_SUCCEED) { + GDKfree(buf); return err; + } /* 10_sys_schema_extensions */ /* if the keyword LOCKED is in the list of keywords, upgrade */ @@ -5030,8 +5034,10 @@ sql_update_sep2022(Client c, mvc *sql) } res_table_destroy(output); output = NULL; - if (err != MAL_SUCCEED) + if (err != MAL_SUCCEED) { + GDKfree(buf); return err; + } /* if the table type UNLOGGED TABLE is not in the list of table * types, upgrade */ @@ -5053,9 +5059,28 @@ sql_update_sep2022(Client c, mvc *sql) err = SQLstatementIntern(c, buf, "update", true, false, NULL); } } + res_table_destroy(output); + output = NULL; /* 16_tracelog */ - pos = snprintf(buf, bufsize, "select f.id from sys.schemas s, sys.functions f, sys.auths a, sys.privileges p, sys.auths g, sys.function_types ft, sys.privilege_codes pc where s.id = f.schema_id and f.id = p.obj_id and p.auth_id = a.id and p.grantor = g.id and p.privileges = pc.privilege_code_id and f.type = ft.function_type_id and s.name = 'sys' and f.name = 'tracelog' and ft.function_type_keyword = 'FUNCTION';\n"); + pos = snprintf(buf, bufsize, + "select f.id " + "from sys.schemas s, " + "sys.functions f, " + "sys.auths a, " + "sys.privileges p, " + "sys.auths g, " + "sys.function_types ft, " + "sys.privilege_codes pc " + "where s.id = f.schema_id " + "and f.id = p.obj_id " + "and p.auth_id = a.id " + "and p.grantor = g.id " + "and p.privileges = pc.privilege_code_id " + "and f.type = ft.function_type_id " _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org