Changeset: 85ac026c352f for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/85ac026c352f Modified Files: sql/backends/monet5/rel_bin.c sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_statement.c sql/benchmarks/tpcds/Tests/one.test.in sql/server/rel_basetable.c sql/server/rel_exp.c sql/server/rel_propagate.c sql/server/rel_select.c sql/server/rel_statistics.c sql/server/rel_statistics.h sql/server/rel_unnest.c sql/server/sql_parser.y sql/test/BugDay_2005-10-06_2.9.3/Tests/CrashMe_SQL_server_crash-2.SF-921673.test sql/test/BugTracker-2023/Tests/greatest-least-multi-arg-7391.test sql/test/BugTracker-2023/Tests/misc-crashes-7390.test sql/test/BugTracker-2024/Tests/alloc-overflow-7432.test sql/test/SQLancer/Tests/sqlancer10.test sql/test/Tests/select_window_pushdown.test sql/test/emptydb/Tests/check.stable.out.32bit sql/test/miscellaneous/Tests/simple_selects.test sql/test/miscellaneous/Tests/unique_keys.test sql/test/sys-schema/Tests/webExamplesComparisonFunctionsOperators.test sql/test/sys-schema/Tests/webExamplesMathematicalFunctionsOperators.test Branch: cleanup_types Log Message:
Merge with default branch. diffs (truncated from 20480 to 300 lines): diff --git a/clients/ChangeLog b/clients/ChangeLog --- a/clients/ChangeLog +++ b/clients/ChangeLog @@ -1,6 +1,19 @@ # ChangeLog file for clients # This file is updated with Maddlog +* Thu Jan 25 2024 Sjoerd Mullender <sjo...@acm.org> +- Msqldump now accepts --output and --outputdir options. When the + --outputdir option is used, the dump is placed in the file dump.sql in + the specified directory and all tables are dumped to separate CSV files. + In this way it is feasible to edit the dump script by hand if needed, + even for a large database. + +* Wed Jan 24 2024 Sjoerd Mullender <sjo...@acm.org> +- The --table (-t) option of msqldump now accepts SQL-style % wildcard + characters to dump all tables that match the pattern. E.g. -t + %test%.%test% dumps all tables with 'test' in both the schema and + table name. + * Wed Jan 10 2024 Sjoerd Mullender <sjo...@acm.org> - Implemented interrupt handling in mclient. When using mclient interactively, an interrupt (usually control-C) stops whatever the diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -182,27 +182,27 @@ sescape(const char *s) } static int -comment_on(stream *toConsole, const char *object, +comment_on(stream *sqlf, const char *object, const char *ident1, const char *ident2, const char *ident3, const char *remark) { if (remark) { - if (mnstr_printf(toConsole, "COMMENT ON %s ", object) < 0 || - dquoted_print(toConsole, ident1, NULL) < 0) + if (mnstr_printf(sqlf, "COMMENT ON %s ", object) < 0 || + dquoted_print(sqlf, ident1, NULL) < 0) return -1; if (ident2) { - if (mnstr_printf(toConsole, ".") < 0 || - dquoted_print(toConsole, ident2, NULL) < 0) + if (mnstr_printf(sqlf, ".") < 0 || + dquoted_print(sqlf, ident2, NULL) < 0) return -1; if (ident3) { - if (mnstr_printf(toConsole, ".") < 0 || - dquoted_print(toConsole, ident3, NULL) < 0) + if (mnstr_printf(sqlf, ".") < 0 || + dquoted_print(sqlf, ident3, NULL) < 0) return -1; } } - if (mnstr_write(toConsole, " IS ", 1, 4) < 0 || - squoted_print(toConsole, remark, '\'', false) < 0 || - mnstr_write(toConsole, ";\n", 1, 2) < 0) + if (mnstr_write(sqlf, " IS ", 1, 4) < 0 || + squoted_print(sqlf, remark, '\'', false) < 0 || + mnstr_write(sqlf, ";\n", 1, 2) < 0) return -1; } return 0; @@ -249,7 +249,7 @@ bailout: else if (mapi_error(mid)) mapi_explain_query(hdl, stderr); else - fprintf(stderr, "malloc failure1\n"); + fprintf(stderr, "malloc failure\n"); mapi_close_handle(hdl); } else if (mapi_error(mid)) mapi_explain(mid, stderr); @@ -453,7 +453,7 @@ bailout: } static int -dump_foreign_keys(Mapi mid, const char *schema, const char *tname, const char *tid, stream *toConsole) +dump_foreign_keys(Mapi mid, const char *schema, const char *tname, const char *tid, stream *sqlf) { MapiHdl hdl = NULL; int cnt, i; @@ -663,31 +663,31 @@ dump_foreign_keys(Mapi mid, const char * } } if (tname == NULL && tid == NULL) { - mnstr_printf(toConsole, "ALTER TABLE "); - dquoted_print(toConsole, c_fsname, "."); - dquoted_print(toConsole, c_ftname, " ADD "); + mnstr_printf(sqlf, "ALTER TABLE "); + dquoted_print(sqlf, c_fsname, "."); + dquoted_print(sqlf, c_ftname, " ADD "); } else { - mnstr_printf(toConsole, ",\n\t"); + mnstr_printf(sqlf, ",\n\t"); } if (c_fkname) { - mnstr_printf(toConsole, "CONSTRAINT "); - dquoted_print(toConsole, c_fkname, " "); + mnstr_printf(sqlf, "CONSTRAINT "); + dquoted_print(sqlf, c_fkname, " "); } - mnstr_printf(toConsole, "FOREIGN KEY ("); + mnstr_printf(sqlf, "FOREIGN KEY ("); for (i = 0; i < nkeys; i++) { if (i > 0) - mnstr_printf(toConsole, ", "); - dquoted_print(toConsole, fkeys[i], NULL); + mnstr_printf(sqlf, ", "); + dquoted_print(sqlf, fkeys[i], NULL); } - mnstr_printf(toConsole, ") REFERENCES "); - dquoted_print(toConsole, c_psname, "."); - dquoted_print(toConsole, c_ptname, " ("); + mnstr_printf(sqlf, ") REFERENCES "); + dquoted_print(sqlf, c_psname, "."); + dquoted_print(sqlf, c_ptname, " ("); for (i = 0; i < nkeys; i++) { if (i > 0) - mnstr_printf(toConsole, ", "); - dquoted_print(toConsole, pkeys[i], NULL); + mnstr_printf(sqlf, ", "); + dquoted_print(sqlf, pkeys[i], NULL); } - mnstr_printf(toConsole, ")"); + mnstr_printf(sqlf, ")"); if (c_faction) { int action = atoi(c_faction); int on_update; @@ -696,12 +696,12 @@ dump_foreign_keys(Mapi mid, const char * if ((on_delete = action & 255) != 0 && on_delete < NR_ACTIONS && on_delete != 2 /* RESTRICT -- default */) - mnstr_printf(toConsole, " ON DELETE %s", + mnstr_printf(sqlf, " ON DELETE %s", actions[on_delete]); if ((on_update = (action >> 8) & 255) != 0 && on_update < NR_ACTIONS && on_update != 2 /* RESTRICT -- default */) - mnstr_printf(toConsole, " ON UPDATE %s", + mnstr_printf(sqlf, " ON UPDATE %s", actions[on_update]); } free(c_psname); @@ -720,9 +720,9 @@ dump_foreign_keys(Mapi mid, const char * free(pkeys); if (tname == NULL && tid == NULL) - mnstr_printf(toConsole, ";\n"); + mnstr_printf(sqlf, ";\n"); - if (mnstr_errnr(toConsole) != MNSTR_NO__ERROR) + if (mnstr_errnr(sqlf) != MNSTR_NO__ERROR) goto bailout; } if (mapi_error(mid)) @@ -737,12 +737,12 @@ bailout: mapi_explain_result(hdl, stderr); else if (mapi_error(mid)) mapi_explain_query(hdl, stderr); - else if (mnstr_errnr(toConsole) == MNSTR_NO__ERROR) + else if (mnstr_errnr(sqlf) == MNSTR_NO__ERROR) fprintf(stderr, "malloc failure\n"); mapi_close_handle(hdl); } else if (mapi_error(mid)) mapi_explain(mid, stderr); - else if (mnstr_errnr(toConsole) == MNSTR_NO__ERROR) + else if (mnstr_errnr(sqlf) == MNSTR_NO__ERROR) fprintf(stderr, "malloc failure\n"); return 1; @@ -765,7 +765,7 @@ toUpper(const char *s) static int dump_column_definition( Mapi mid, - stream *toConsole, + stream *sqlf, const char *schema, const char *tname, const char *tid, @@ -785,105 +785,105 @@ static const char *geomsubtypes[] = { }; static int -dump_type(Mapi mid, stream *toConsole, const char *c_type, const char *c_type_digits, const char *c_type_scale, bool hashge) +dump_type(Mapi mid, stream *sqlf, const char *c_type, const char *c_type_digits, const char *c_type_scale, bool hashge) { int space = 0; if (strcmp(c_type, "boolean") == 0) { - space = mnstr_printf(toConsole, "BOOLEAN"); + space = mnstr_printf(sqlf, "BOOLEAN"); } else if (strcmp(c_type, "int") == 0) { - space = mnstr_printf(toConsole, "INTEGER"); + space = mnstr_printf(sqlf, "INTEGER"); } else if (strcmp(c_type, "smallint") == 0) { - space = mnstr_printf(toConsole, "SMALLINT"); + space = mnstr_printf(sqlf, "SMALLINT"); } else if (strcmp(c_type, "tinyint") == 0) { - space = mnstr_printf(toConsole, "TINYINT"); + space = mnstr_printf(sqlf, "TINYINT"); } else if (strcmp(c_type, "bigint") == 0) { - space = mnstr_printf(toConsole, "BIGINT"); + space = mnstr_printf(sqlf, "BIGINT"); } else if (strcmp(c_type, "hugeint") == 0) { - space = mnstr_printf(toConsole, "HUGEINT"); + space = mnstr_printf(sqlf, "HUGEINT"); } else if (strcmp(c_type, "date") == 0) { - space = mnstr_printf(toConsole, "DATE"); + space = mnstr_printf(sqlf, "DATE"); } else if (strcmp(c_type, "month_interval") == 0) { if (strcmp(c_type_digits, "1") == 0) - space = mnstr_printf(toConsole, "INTERVAL YEAR"); + space = mnstr_printf(sqlf, "INTERVAL YEAR"); else if (strcmp(c_type_digits, "2") == 0) - space = mnstr_printf(toConsole, "INTERVAL YEAR TO MONTH"); + space = mnstr_printf(sqlf, "INTERVAL YEAR TO MONTH"); else if (strcmp(c_type_digits, "3") == 0) - space = mnstr_printf(toConsole, "INTERVAL MONTH"); + space = mnstr_printf(sqlf, "INTERVAL MONTH"); else fprintf(stderr, "Internal error: unrecognized month interval %s\n", c_type_digits); } else if (strcmp(c_type, "day_interval") == 0 || strcmp(c_type, "sec_interval") == 0) { if (strcmp(c_type_digits, "4") == 0) - space = mnstr_printf(toConsole, "INTERVAL DAY"); + space = mnstr_printf(sqlf, "INTERVAL DAY"); else if (strcmp(c_type_digits, "5") == 0) - space = mnstr_printf(toConsole, "INTERVAL DAY TO HOUR"); + space = mnstr_printf(sqlf, "INTERVAL DAY TO HOUR"); else if (strcmp(c_type_digits, "6") == 0) - space = mnstr_printf(toConsole, "INTERVAL DAY TO MINUTE"); + space = mnstr_printf(sqlf, "INTERVAL DAY TO MINUTE"); else if (strcmp(c_type_digits, "7") == 0) - space = mnstr_printf(toConsole, "INTERVAL DAY TO SECOND"); + space = mnstr_printf(sqlf, "INTERVAL DAY TO SECOND"); else if (strcmp(c_type_digits, "8") == 0) - space = mnstr_printf(toConsole, "INTERVAL HOUR"); + space = mnstr_printf(sqlf, "INTERVAL HOUR"); else if (strcmp(c_type_digits, "9") == 0) - space = mnstr_printf(toConsole, "INTERVAL HOUR TO MINUTE"); + space = mnstr_printf(sqlf, "INTERVAL HOUR TO MINUTE"); else if (strcmp(c_type_digits, "10") == 0) - space = mnstr_printf(toConsole, "INTERVAL HOUR TO SECOND"); + space = mnstr_printf(sqlf, "INTERVAL HOUR TO SECOND"); else if (strcmp(c_type_digits, "11") == 0) - space = mnstr_printf(toConsole, "INTERVAL MINUTE"); + space = mnstr_printf(sqlf, "INTERVAL MINUTE"); else if (strcmp(c_type_digits, "12") == 0) - space = mnstr_printf(toConsole, "INTERVAL MINUTE TO SECOND"); + space = mnstr_printf(sqlf, "INTERVAL MINUTE TO SECOND"); else if (strcmp(c_type_digits, "13") == 0) - space = mnstr_printf(toConsole, "INTERVAL SECOND"); + space = mnstr_printf(sqlf, "INTERVAL SECOND"); else fprintf(stderr, "Internal error: unrecognized second interval %s\n", c_type_digits); } else if (strcmp(c_type, "clob") == 0 || (strcmp(c_type, "varchar") == 0 && strcmp(c_type_digits, "0") == 0)) { - space = mnstr_printf(toConsole, "CHARACTER LARGE OBJECT"); + space = mnstr_printf(sqlf, "CHARACTER LARGE OBJECT"); if (strcmp(c_type_digits, "0") != 0) - space += mnstr_printf(toConsole, "(%s)", c_type_digits); + space += mnstr_printf(sqlf, "(%s)", c_type_digits); } else if (strcmp(c_type, "blob") == 0) { - space = mnstr_printf(toConsole, "BINARY LARGE OBJECT"); + space = mnstr_printf(sqlf, "BINARY LARGE OBJECT"); if (strcmp(c_type_digits, "0") != 0) - space += mnstr_printf(toConsole, "(%s)", c_type_digits); + space += mnstr_printf(sqlf, "(%s)", c_type_digits); } else if (strcmp(c_type, "timestamp") == 0 || strcmp(c_type, "timestamptz") == 0) { - space = mnstr_printf(toConsole, "TIMESTAMP"); + space = mnstr_printf(sqlf, "TIMESTAMP"); if (strcmp(c_type_digits, "7") != 0) - space += mnstr_printf(toConsole, "(%d)", atoi(c_type_digits) - 1); + space += mnstr_printf(sqlf, "(%d)", atoi(c_type_digits) - 1); if (strcmp(c_type, "timestamptz") == 0) - space += mnstr_printf(toConsole, " WITH TIME ZONE"); + space += mnstr_printf(sqlf, " WITH TIME ZONE"); } else if (strcmp(c_type, "time") == 0 || strcmp(c_type, "timetz") == 0) { - space = mnstr_printf(toConsole, "TIME"); + space = mnstr_printf(sqlf, "TIME"); if (strcmp(c_type_digits, "1") != 0) - space += mnstr_printf(toConsole, "(%d)", atoi(c_type_digits) - 1); + space += mnstr_printf(sqlf, "(%d)", atoi(c_type_digits) - 1); if (strcmp(c_type, "timetz") == 0) - space += mnstr_printf(toConsole, " WITH TIME ZONE"); + space += mnstr_printf(sqlf, " WITH TIME ZONE"); } else if (strcmp(c_type, "real") == 0) { if (strcmp(c_type_digits, "24") == 0 && strcmp(c_type_scale, "0") == 0) - space = mnstr_printf(toConsole, "REAL"); + space = mnstr_printf(sqlf, "REAL"); else if (strcmp(c_type_scale, "0") == 0) - space = mnstr_printf(toConsole, "FLOAT(%s)", c_type_digits); + space = mnstr_printf(sqlf, "FLOAT(%s)", c_type_digits); else - space = mnstr_printf(toConsole, "FLOAT(%s,%s)", + space = mnstr_printf(sqlf, "FLOAT(%s,%s)", _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org