Changeset: b479a3cccc31 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/b479a3cccc31 Branch: sw_ew_c_sorting Log Message:
Merge with Dec2023 branch diffs (truncated from 4274 to 300 lines): diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -50340,7 +50340,12 @@ SQLwindow_bound; computes window ranges for each row sqlcatalog alter_add_range_partition -pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int):void +pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:bat[:lng]):void +SQLalter_add_range_partition; +Catalog operation alter_add_range_partition +sqlcatalog +alter_add_range_partition +pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:lng):void SQLalter_add_range_partition; Catalog operation alter_add_range_partition sqlcatalog @@ -50350,12 +50355,22 @@ SQLalter_add_table; Catalog operation alter_add_table sqlcatalog alter_add_value_partition -pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int):void +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:bat[:lng]):void SQLalter_add_value_partition; Catalog operation alter_add_value_partition sqlcatalog alter_add_value_partition -pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:any...):void +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:bat[:lng], X_7:any...):void +SQLalter_add_value_partition; +Catalog operation alter_add_value_partition +sqlcatalog +alter_add_value_partition +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:lng):void +SQLalter_add_value_partition; +Catalog operation alter_add_value_partition +sqlcatalog +alter_add_value_partition +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:lng, X_7:any...):void SQLalter_add_value_partition; Catalog operation alter_add_value_partition sqlcatalog diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -38665,7 +38665,12 @@ SQLwindow_bound; computes window ranges for each row sqlcatalog alter_add_range_partition -pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int):void +pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:bat[:lng]):void +SQLalter_add_range_partition; +Catalog operation alter_add_range_partition +sqlcatalog +alter_add_range_partition +pattern sqlcatalog.alter_add_range_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:any_1, X_5:any_1, X_6:bit, X_7:int, X_8:lng):void SQLalter_add_range_partition; Catalog operation alter_add_range_partition sqlcatalog @@ -38675,12 +38680,22 @@ SQLalter_add_table; Catalog operation alter_add_table sqlcatalog alter_add_value_partition -pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int):void +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:bat[:lng]):void SQLalter_add_value_partition; Catalog operation alter_add_value_partition sqlcatalog alter_add_value_partition -pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:any...):void +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:bat[:lng], X_7:any...):void +SQLalter_add_value_partition; +Catalog operation alter_add_value_partition +sqlcatalog +alter_add_value_partition +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:lng):void +SQLalter_add_value_partition; +Catalog operation alter_add_value_partition +sqlcatalog +alter_add_value_partition +pattern sqlcatalog.alter_add_value_partition(X_0:str, X_1:str, X_2:str, X_3:str, X_4:bit, X_5:int, X_6:lng, X_7:any...):void SQLalter_add_value_partition; Catalog operation alter_add_value_partition sqlcatalog diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -3154,6 +3154,123 @@ dump_database(Mapi mid, stream *toConsol mapi_close_handle(hdl); hdl = NULL; + /* dump views, functions and triggers */ + if ((hdl = mapi_query(mid, views_functions_triggers)) == NULL || + mapi_error(mid)) + goto bailout; + + while (rc == 0 && + mnstr_errnr(toConsole) == MNSTR_NO__ERROR && + mapi_fetch_row(hdl) != 0) { + char *id = strdup(mapi_fetch_field(hdl, 0)); + char *schema = strdup(mapi_fetch_field(hdl, 1)); + char *name = strdup(mapi_fetch_field(hdl, 2)); + const char *query = mapi_fetch_field(hdl, 3); + const char *remark = mapi_fetch_field(hdl, 4); + + if (mapi_error(mid) || id == NULL || schema == NULL || name == NULL) { + free(id); + free(schema); + free(name); + goto bailout; + } + if (sname != NULL && strcmp(schema, sname) != 0) { + free(id); + free(schema); + free(name); + continue; + } + if (curschema == NULL || strcmp(schema, curschema) != 0) { + if (curschema) + free(curschema); + curschema = strdup(schema); + if (curschema == NULL) { + free(id); + free(schema); + free(name); + goto bailout; + } + mnstr_printf(toConsole, "SET SCHEMA "); + dquoted_print(toConsole, curschema, ";\n"); + } + if (query) { + /* view or trigger */ + mnstr_printf(toConsole, "%s\n", query); + /* only views have comments due to query */ + comment_on(toConsole, "VIEW", schema, name, NULL, remark); + } else { + /* procedure */ + dump_functions(mid, toConsole, 0, schema, name, id); + } + free(id); + free(schema); + free(name); + } + mapi_close_handle(hdl); + hdl = NULL; + + /* dump DEFAULT clauses for tables */ + if (dump_table_defaults(mid, NULL, NULL, toConsole)) + goto bailout2; + + if (!describe) { + if (dump_foreign_keys(mid, NULL, NULL, NULL, toConsole)) + goto bailout2; + + /* dump sequences, part 2 */ + if ((hdl = mapi_query(mid, sequences2)) == NULL || + mapi_error(mid)) + goto bailout; + + while (mapi_fetch_row(hdl) != 0) { + const char *schema = mapi_fetch_field(hdl, 0); /* sch */ + const char *name = mapi_fetch_field(hdl, 1); /* seq */ + const char *restart = mapi_fetch_field(hdl, 3); /* rs */ + const char *minvalue; + const char *maxvalue; + const char *increment = mapi_fetch_field(hdl, 6); /* inc */ + const char *cycle = mapi_fetch_field(hdl, 8); /* cycle */ + + if (mapi_get_field_count(hdl) > 9) { + /* new version (Jan2022) of sys.describe_sequences */ + minvalue = mapi_fetch_field(hdl, 11); /* rmi */ + maxvalue = mapi_fetch_field(hdl, 12); /* rma */ + } else { + /* old version (pre Jan2022) of sys.describe_sequences */ + minvalue = mapi_fetch_field(hdl, 4); /* minvalue */ + maxvalue = mapi_fetch_field(hdl, 5); /* maxvalue */ + if (strcmp(minvalue, "0") == 0) + minvalue = NULL; + if (strcmp(maxvalue, "0") == 0) + maxvalue = NULL; + } + + if (sname != NULL && strcmp(schema, sname) != 0) + continue; + + mnstr_printf(toConsole, + "ALTER SEQUENCE "); + dquoted_print(toConsole, schema, "."); + dquoted_print(toConsole, name, NULL); + mnstr_printf(toConsole, " RESTART WITH %s", restart); + if (strcmp(increment, "1") != 0) + mnstr_printf(toConsole, " INCREMENT BY %s", increment); + if (minvalue) + mnstr_printf(toConsole, " MINVALUE %s", minvalue); + if (maxvalue) + mnstr_printf(toConsole, " MAXVALUE %s", maxvalue); + mnstr_printf(toConsole, " %sCYCLE;\n", strcmp(cycle, "true") == 0 ? "" : "NO "); + if (mnstr_errnr(toConsole) != MNSTR_NO__ERROR) { + mapi_close_handle(hdl); + hdl = NULL; + goto bailout2; + } + } + if (mapi_error(mid)) + goto bailout; + mapi_close_handle(hdl); + } + /* add tables to MERGE tables */ if ((hdl = mapi_query(mid, mergetables)) == NULL || mapi_error(mid)) goto bailout; @@ -3285,123 +3402,6 @@ dump_database(Mapi mid, stream *toConsol mapi_close_handle(hdl); hdl = NULL; - /* dump views, functions and triggers */ - if ((hdl = mapi_query(mid, views_functions_triggers)) == NULL || - mapi_error(mid)) - goto bailout; - - while (rc == 0 && - mnstr_errnr(toConsole) == MNSTR_NO__ERROR && - mapi_fetch_row(hdl) != 0) { - char *id = strdup(mapi_fetch_field(hdl, 0)); - char *schema = strdup(mapi_fetch_field(hdl, 1)); - char *name = strdup(mapi_fetch_field(hdl, 2)); - const char *query = mapi_fetch_field(hdl, 3); - const char *remark = mapi_fetch_field(hdl, 4); - - if (mapi_error(mid) || id == NULL || schema == NULL || name == NULL) { - free(id); - free(schema); - free(name); - goto bailout; - } - if (sname != NULL && strcmp(schema, sname) != 0) { - free(id); - free(schema); - free(name); - continue; - } - if (curschema == NULL || strcmp(schema, curschema) != 0) { - if (curschema) - free(curschema); - curschema = strdup(schema); - if (curschema == NULL) { - free(id); - free(schema); - free(name); - goto bailout; - } - mnstr_printf(toConsole, "SET SCHEMA "); - dquoted_print(toConsole, curschema, ";\n"); - } - if (query) { - /* view or trigger */ - mnstr_printf(toConsole, "%s\n", query); - /* only views have comments due to query */ - comment_on(toConsole, "VIEW", schema, name, NULL, remark); - } else { - /* procedure */ - dump_functions(mid, toConsole, 0, schema, name, id); - } - free(id); - free(schema); - free(name); - } - mapi_close_handle(hdl); - hdl = NULL; - - /* dump DEFAULT clauses for tables */ - if (dump_table_defaults(mid, NULL, NULL, toConsole)) - goto bailout2; - - if (!describe) { - if (dump_foreign_keys(mid, NULL, NULL, NULL, toConsole)) - goto bailout2; - - /* dump sequences, part 2 */ - if ((hdl = mapi_query(mid, sequences2)) == NULL || - mapi_error(mid)) - goto bailout; - - while (mapi_fetch_row(hdl) != 0) { - const char *schema = mapi_fetch_field(hdl, 0); /* sch */ - const char *name = mapi_fetch_field(hdl, 1); /* seq */ - const char *restart = mapi_fetch_field(hdl, 3); /* rs */ - const char *minvalue; - const char *maxvalue; - const char *increment = mapi_fetch_field(hdl, 6); /* inc */ - const char *cycle = mapi_fetch_field(hdl, 8); /* cycle */ - - if (mapi_get_field_count(hdl) > 9) { - /* new version (Jan2022) of sys.describe_sequences */ - minvalue = mapi_fetch_field(hdl, 11); /* rmi */ - maxvalue = mapi_fetch_field(hdl, 12); /* rma */ - } else { - /* old version (pre Jan2022) of sys.describe_sequences */ - minvalue = mapi_fetch_field(hdl, 4); /* minvalue */ - maxvalue = mapi_fetch_field(hdl, 5); /* maxvalue */ _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org