Changeset: 9ad933bcfdc3 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/9ad933bcfdc3 Modified Files: .hgtags Branch: geo-update Log Message:
Merging with default due to problem with filter functions diffs (truncated from 95650 to 300 lines): diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -768,3 +768,4 @@ 2e54857a91306cc6304825c5596f65d00595db6b 1252291e5c0ddc91ccb16d612d04e34e6a7d3bc3 Jun2020_13 1252291e5c0ddc91ccb16d612d04e34e6a7d3bc3 Jun2020_SP2_release 59de1ee118d4eccc072c0cf3938f90635a7db311 Jan2022_15 +59de1ee118d4eccc072c0cf3938f90635a7db311 Jan2022_SP3_release diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,6 @@ if(NOT HAVE_SYS_SOCKET_H) set(CMAKE_EXTRA_INCLUDE_FILES "winsock.h") endif() endif() -set(CMAKE_REQUIRED_INCLUDES "/usr/include") monetdb_configure_sizes() diff --git a/clients/ChangeLog.Jan2022 b/clients/ChangeLog.Jan2022 --- a/clients/ChangeLog.Jan2022 +++ b/clients/ChangeLog.Jan2022 @@ -1,3 +1,9 @@ # ChangeLog file for clients # This file is updated with Maddlog +* Tue May 31 2022 Sjoerd Mullender <sjo...@acm.org> +- Fixed a bug where when the semicolon at the end of a COPY INTO query + that reads from STDIN is at exactly a 10240 byte boundary in a file, + the data isn't read as input for the COPY INTO but instead as a new + SQL query. + diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -190,6 +190,7 @@ gdk_return BATsemijoin(BAT **r1p, BAT ** BAT *BATsetaccess(BAT *b, restrict_t mode) __attribute__((__warn_unused_result__)); void BATsetcapacity(BAT *b, BUN cnt); void BATsetcount(BAT *b, BUN cnt); +gdk_return BATsetstrimps(BAT *b); BAT *BATslice(BAT *b, BUN low, BUN high); gdk_return BATsort(BAT **sorted, BAT **order, BAT **groups, BAT *b, BAT *o, BAT *g, bool reverse, bool nilslast, bool stable) __attribute__((__warn_unused_result__)); gdk_return BATstr_group_concat(ValPtr res, BAT *b, BAT *s, BAT *sep, bool skip_nils, bool nil_if_empty, const char *restrict separator); @@ -200,7 +201,6 @@ gdk_return BATsum(void *res, int tp, BAT gdk_return BATthetajoin(BAT **r1p, BAT **r2p, BAT *l, BAT *r, BAT *sl, BAT *sr, int op, bool nil_matches, BUN estimate) __attribute__((__warn_unused_result__)); BAT *BATthetaselect(BAT *b, BAT *s, const void *val, const char *op); void BATtseqbase(BAT *b, oid o); -void BATundo(BAT *b); BAT *BATunique(BAT *b, BAT *s); BAT *BATunmask(BAT *b); gdk_return BATupdate(BAT *b, BAT *p, BAT *n, bool force) __attribute__((__warn_unused_result__)); @@ -401,7 +401,7 @@ BUN SORTfndfirst(BAT *b, const void *v); BUN SORTfndlast(BAT *b, const void *v); gdk_return STRMPcreate(BAT *b, BAT *s); void STRMPdestroy(BAT *b); -BAT *STRMPfilter(BAT *b, BAT *s, const char *q); +BAT *STRMPfilter(BAT *b, BAT *s, const char *q, const bool keep_nils); MT_Id THRcreate(void (*f)(void *), void *arg, enum MT_thr_detach d, const char *name); void *THRdata[THREADDATA]; void THRdel(Thread t); diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -2575,29 +2575,32 @@ dump_database(Mapi mid, stream *toConsol "SELECT s.name, t.name, " "a.name, " "sum(p.privileges), " - "g.name, p.grantable " + "g.name, go.opt " "FROM sys.schemas s, sys.tables t, " "sys.auths a, sys.privileges p, " - "sys.auths g " + "sys.auths g, " + "(VALUES (0, ''), (1, ' WITH GRANT OPTION')) AS go (id, opt) " "WHERE p.obj_id = t.id " "AND p.auth_id = a.id " "AND t.schema_id = s.id " "AND t.system = FALSE " "AND p.grantor = g.id " - "GROUP BY s.name, t.name, a.name, g.name, p.grantable " - "ORDER BY s.name, t.name, a.name, g.name, p.grantable"; + "AND p.grantable = go.id " + "GROUP BY s.name, t.name, a.name, g.name, go.opt " + "ORDER BY s.name, t.name, a.name, g.name, go.opt"; const char *column_grants = "SELECT s.name, t.name, " "c.name, a.name, " "pc.privilege_code_name, " - "g.name, p.grantable " + "g.name, go.opt " "FROM sys.schemas s, " "sys.tables t, " "sys.columns c, " "sys.auths a, " "sys.privileges p, " "sys.auths g, " - "sys.privilege_codes pc " + "sys.privilege_codes pc, " + "(VALUES (0, ''), (1, ' WITH GRANT OPTION')) AS go (id, opt) " "WHERE p.obj_id = c.id " "AND c.table_id = t.id " "AND p.auth_id = a.id " @@ -2605,16 +2608,18 @@ dump_database(Mapi mid, stream *toConsol "AND t.system = FALSE " "AND p.grantor = g.id " "AND p.privileges = pc.privilege_code_id " + "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, p.grantable, " + "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 " + "sys.privilege_codes pc, " + "(VALUES (0, ''), (1, ' WITH GRANT OPTION')) AS go (id, opt) " "WHERE s.id = f.schema_id " "AND f.id = p.obj_id " "AND p.auth_id = a.id " @@ -2622,7 +2627,21 @@ dump_database(Mapi mid, stream *toConsol "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"; + const char *global_grants = + "SELECT a.name, pc.grnt, g.name, go.opt " + "FROM sys.privileges p, " + "sys.auths a, " + "sys.auths g, " + "(VALUES (0, 'COPY INTO'), (1, 'COPY FROM')) AS pc (id, grnt), " + "(VALUES (0, ''), (1, ' WITH GRANT OPTION')) AS go (id, opt) " + "WHERE p.obj_id = 0 " + "AND p.auth_id = a.id " + "AND p.grantor = g.id " + "AND p.privileges = pc.id " + "AND p.grantable = go.id " + "ORDER BY a.name, g.name, go.opt"; const char *schemas = "SELECT s.name, a.name, rem.remark " "FROM sys.schemas s LEFT OUTER JOIN sys.comments rem ON s.id = rem.id, " @@ -2870,6 +2889,23 @@ dump_database(Mapi mid, stream *toConsol if (mapi_error(mid)) goto bailout; mapi_close_handle(hdl); + + /* grant global privileges */ + if ((hdl = mapi_query(mid, global_grants)) == NULL || mapi_error(mid)) + goto bailout; + + while (mapi_fetch_row(hdl) != 0) { + const char *uname = mapi_fetch_field(hdl, 0); + const char *grant = mapi_fetch_field(hdl, 1); + //const char *gname = mapi_fetch_field(hdl, 2); + const char *grantable = mapi_fetch_field(hdl, 3); + mnstr_printf(toConsole, "GRANT %s TO ", grant); + dquoted_print(toConsole, uname, grantable); + mnstr_printf(toConsole, ";\n"); + } + if (mapi_error(mid)) + goto bailout; + mapi_close_handle(hdl); } /* dump types */ @@ -3267,9 +3303,7 @@ dump_database(Mapi mid, stream *toConsol mnstr_printf(toConsole, " ON TABLE "); dquoted_print(toConsole, schema, "."); dquoted_print(toConsole, tname, " TO "); - dquoted_print(toConsole, aname, NULL); - if (strcmp(grantable, "1") == 0) - mnstr_printf(toConsole, " WITH GRANT OPTION"); + dquoted_print(toConsole, aname, grantable); mnstr_printf(toConsole, ";\n"); } if (mapi_error(mid)) @@ -3293,9 +3327,7 @@ dump_database(Mapi mid, stream *toConsol dquoted_print(toConsole, cname, ") ON "); dquoted_print(toConsole, schema, "."); dquoted_print(toConsole, tname, " TO "); - dquoted_print(toConsole, aname, NULL); - if (strcmp(grantable, "1") == 0) - mnstr_printf(toConsole, " WITH GRANT OPTION"); + dquoted_print(toConsole, aname, grantable); mnstr_printf(toConsole, ";\n"); } if (mapi_error(mid)) @@ -3319,9 +3351,7 @@ dump_database(Mapi mid, stream *toConsol mnstr_printf(toConsole, "GRANT %s ON %s ", priv, ftype); dquoted_print(toConsole, schema, "."); dquoted_print(toConsole, fname, " TO "); - dquoted_print(toConsole, aname, NULL); - if (strcmp(grantable, "1") == 0) - mnstr_printf(toConsole, " WITH GRANT OPTION"); + dquoted_print(toConsole, aname, grantable); mnstr_printf(toConsole, ";\n"); } if (mapi_error(mid)) diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -2042,6 +2042,7 @@ static bool doFileBulk(Mapi mid, stream *fp) { char *buf = NULL; + size_t semicolon1 = 0, semicolon2 = 0; ssize_t length; MapiHdl hdl = mapi_get_active(mid); MapiMsg rc = MOK; @@ -2064,18 +2065,28 @@ doFileBulk(Mapi mid, stream *fp) break; length = 0; buf[0] = 0; - } else if ((length = mnstr_read(fp, buf, 1, bufsize)) <= 0) { - /* end of file or error */ - if (hdl == NULL) + } else { + if ((length = mnstr_read(fp, buf, 1, bufsize)) < 0) { + /* error */ + errseen = true; break; /* nothing more to do */ - buf[0] = 0; - length = 0; /* handle error like EOF */ - } else { - buf[length] = 0; - if (strlen(buf) < (size_t) length) { - mnstr_printf(stderr_stream, "NULL byte in input\n"); - errseen = true; - break; + } else { + buf[length] = 0; + if (length == 0) { + /* end of file */ + if (semicolon2 == 0 && hdl == NULL) + break; /* nothing more to do */ + } else { + if (strlen(buf) < (size_t) length) { + mnstr_printf(stderr_stream, "NULL byte in input\n"); + errseen = true; + break; + } + while (length > 1 && buf[length - 1] == ';') { + semicolon1++; + buf[--length] = 0; + } + } } } timerResume(); @@ -2085,7 +2096,15 @@ doFileBulk(Mapi mid, stream *fp) } assert(hdl != NULL); - mapi_query_part(hdl, buf, (size_t) length); + while (semicolon2 > 0) { + mapi_query_part(hdl, ";", 1); + CHECK_RESULT(mid, hdl, buf, fp); + semicolon2--; + } + semicolon2 = semicolon1; + semicolon1 = 0; + if (length > 0) + mapi_query_part(hdl, buf, (size_t) length); CHECK_RESULT(mid, hdl, buf, fp); /* if not at EOF, make sure there is a newline in the diff --git a/clients/odbc/ChangeLog b/clients/odbc/ChangeLog --- a/clients/odbc/ChangeLog +++ b/clients/odbc/ChangeLog @@ -1,6 +1,25 @@ # ChangeLog file for odbc # This file is updated with Maddlog +* Thu Jun 9 2022 Martin van Dinther <martin.van.dint...@monetdbsolutions.com> +- For SQLForeignKeys() corrected the output of columns UPDATE_RULE and + DELETE_RULE. These columns used to always return 3 (= SQL_NO_ACTION) + but now they will report the action codes as specified in the FOREIGN KEY + CONSTRAINT construction. + +* Thu Jun 2 2022 Martin van Dinther <martin.van.dint...@monetdbsolutions.com> +- Fixed issue in function SQLProcedureColumns(). When the argument ColumnName + was not empty it generated an invalid SQL query which failed with error: + SELECT: no such column 'c.name'. This has been resolved. +- Corrected implementation of SQLGetInfo(hdbc, SQL_MAX_DRIVER_CONNECTIONS, ...). + It used to always return 64. Now it returns the value from the MonetDB server. +- Changed the column names case of the result sets as returned by + SQLTables(), SQLColumns(), SQLSpecialColumns(), SQLPrimaryKeys(), + SQLForeignKeys(), SQLStatistics(), SQLTablePrivileges(), + SQLColumnPrivileges(), SQLProcedures() and SQLProcedureColumns(). The + column names where all in lowercase but the ODBC specification defines + them in uppercase, so changed them to uppercase. + * Thu May 19 2022 Martin van Dinther <martin.van.dint...@monetdbsolutions.com> - Corrected SQLSpecialColumns(..., SQL_BEST_ROWID, ...). Previously it only returned rows when the table had a primary key. Now it also returns diff --git a/clients/odbc/driver/ODBCDbc.h b/clients/odbc/driver/ODBCDbc.h _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org