MonetDB: label - Approve upgrade.
Changeset: dae30aa04d0b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/dae30aa04d0b Modified Files: sql/backends/monet5/sql_upgrades.c sql/scripts/76_dump.sql sql/test/emptydb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-previous-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out sql/test/emptydb-previous-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out sql/test/emptydb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/emptydb-upgrade/Tests/upgrade.stable.out sql/test/emptydb-upgrade/Tests/upgrade.stable.out.int128 sql/test/emptydb/Tests/check.stable.out sql/test/emptydb/Tests/check.stable.out.32bit sql/test/emptydb/Tests/check.stable.out.int128 sql/test/testdb-previous-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-previous-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-previous-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out sql/test/testdb-previous-upgrade/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out sql/test/testdb-upgrade-chain/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade-hge/Tests/upgrade.stable.out.int128 sql/test/testdb-upgrade/Tests/upgrade.stable.out sql/test/testdb-upgrade/Tests/upgrade.stable.out.int128 Branch: label Log Message: Approve upgrade. diffs (truncated from 4124 to 300 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 @@ -7002,7 +7002,6 @@ sql_update_default(Client c, mvc *sql, s " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_add_schemas_to_users;\n" " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_grant_user_privileges;\n" " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_sequences;\n" - "\n" " --functions and table-likes can be interdependent. They should be inserted in the order of their catalogue id.\n" " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(ORDER BY stmts.o), stmts.s\n" " FROM (\n" @@ -7010,12 +7009,10 @@ sql_update_default(Client c, mvc *sql, s " UNION ALL\n" " SELECT t.o, t.stmt FROM sys.dump_tables t\n" " ) AS stmts(o, s);\n" - "\n" " -- dump table data before adding constraints and fixing sequences\n" " IF NOT DESCRIBE THEN\n" " CALL sys.dump_table_data();\n" " END IF;\n" - "\n" " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_start_sequences;\n" " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_column_defaults;\n" " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_table_constraint_type;\n" @@ -7027,13 +7024,10 @@ sql_update_default(Client c, mvc *sql, s " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_table_grants;\n" " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_column_grants;\n" " INSERT INTO sys.dump_statements SELECT (SELECT COUNT(*) FROM sys.dump_statements) + RANK() OVER(), stmt FROM sys.dump_function_grants;\n" -
MonetDB: label - Dump CHECK constraints.
Changeset: 5cdf070153fa for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/5cdf070153fa Modified Files: clients/mapiclient/dump.c sql/server/rel_dump.c sql/test/testdb/Tests/dump-nogeom.stable.out sql/test/testdb/Tests/dump.stable.out Branch: label Log Message: Dump CHECK constraints. diffs (139 lines): diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -1119,7 +1119,9 @@ dump_column_definition(Mapi mid, stream "SELECT kc.name, " /* 0 */ "kc.nr, " /* 1 */ "k.name, " /* 2 */ - "kc.id "/* 3 */ + "kc.id, " /* 3 */ + "k.type, " /* 4 */ + "case when k.type = 4 then sys.check_constraint(s.name, k.name) else null end " /* 5 */ "FROM sys.objects kc, " "sys.keys k " "WHERE kc.id = k.id " @@ -1132,14 +1134,15 @@ dump_column_definition(Mapi mid, stream "kc.nr, " /* 1 */ "k.name, " /* 2 */ "kc.id, " /* 3 */ - "k.type " /* 4 */ + "k.type, " /* 4 */ + "case when k.type = 4 then sys.check_constraint(s.name, k.name) else null end " /* 5 */ "FROM sys.objects kc, " "sys.keys k, " "sys.schemas s, " "sys._tables t " "WHERE kc.id = k.id " "AND k.table_id = t.id " - "AND k.type in (1, 3) " + "AND k.type in (1, 3, 4) " "AND t.schema_id = s.id " "AND s.name = '%s' " "AND t.name = '%s' " @@ -1158,16 +1161,28 @@ dump_column_definition(Mapi mid, stream if (strcmp(kc_nr, "0") == 0) { if (cnt) mnstr_write(sqlf, ")", 1, 1); + cnt = 0; mnstr_printf(sqlf, ",\n\t"); if (k_name) { mnstr_printf(sqlf, "CONSTRAINT "); dquoted_print(sqlf, k_name, " "); } - mnstr_printf(sqlf, "UNIQUE%s (", strcmp(k_type, "1") == 0 ? "" : " NULLS NOT DISTINCT"); - cnt = 1; + if (strcmp(k_type, "4") == 0) { + const char *k_check = mapi_fetch_field(hdl, 5); + mnstr_printf(sqlf, "CHECK (%s)", k_check); + } else { + if (strcmp(k_type, "1") == 0) { + mnstr_printf(sqlf, "UNIQUE"); + } else { + mnstr_printf(sqlf, "UNIQUE NULLS NOT DISTINCT"); + } + mnstr_printf(sqlf, " ("); + cnt = 1; + } } else mnstr_printf(sqlf, ", "); - dquoted_print(sqlf, c_column, NULL); + if (cnt) + dquoted_print(sqlf, c_column, NULL); if (mnstr_errnr(sqlf) != MNSTR_NO__ERROR) goto bailout; } diff --git a/sql/server/rel_dump.c b/sql/server/rel_dump.c --- a/sql/server/rel_dump.c +++ b/sql/server/rel_dump.c @@ -2525,6 +2525,29 @@ is_infix(sql_func *f) return false; } +static void +exp2sql_dquoted(stream *fout, const char *pref, const char *val, const char *suff) +{ + if (pref) + mnstr_printf(fout, "%s", pref); + mnstr_write(fout, "\"", 1, 1); + while (*val) { + const char *p = strchr(val, '"'); + if (p) { + if (p > val) + mnstr_write(fout, val, 1, p - val); + mnstr_write(fout, "\"\"", 1, 2); + val = p + 1; + } else { + mnstr_printf(fout, "%s", val); + break; + } + } + mnstr_write(fout, "\"", 1, 1); + if (suff) + mnstr_printf(fout, "%s", suff); +} + /* only simple expressions, ie recursive no psm */ static void exp2sql_print(mvc *sql, stream *fout, sql_exp *e) @@ -2538,7 +2561
MonetDB: label - Approve test output.
Changeset: 78e6ad71f298 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/78e6ad71f298 Modified Files: sql/test/prepare/Tests/sqlancer_prepare.stable.out Branch: label Log Message: Approve test output. diffs (19 lines): diff --git a/sql/test/prepare/Tests/sqlancer_prepare.stable.out b/sql/test/prepare/Tests/sqlancer_prepare.stable.out --- a/sql/test/prepare/Tests/sqlancer_prepare.stable.out +++ b/sql/test/prepare/Tests/sqlancer_prepare.stable.out @@ -153,13 +153,13 @@ % type,digits, scale, schema, table, column # name % varchar, int,int,varchar,varchar,varchar # type % 6, 2, 1, 0, 3, 3 # length -[ "json", 0, 0, "", "%15", "%15" ] +[ "json", 0, 0, "", "%10", "%10" ] [ "bigint",63, 0, NULL, NULL, NULL] % .prepare,.prepare, .prepare, .prepare, .prepare, .prepare # table_name % type,digits, scale, schema, table, column # name % varchar, int,int,varchar,varchar,varchar # type % 6, 2, 1, 0, 3, 3 # length -[ "json", 0, 0, "", "%15", "%15" ] +[ "json", 0, 0, "", "%10", "%10" ] [ "bigint",63, 0, NULL, NULL, NULL] % .prepare,.prepare, .prepare, .prepare, .prepare, .prepare # table_name % type,digits, scale, schema, table, column # name ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - A little cleanup.
Changeset: 79a1251eda6b for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/79a1251eda6b Modified Files: cmake/monetdb-versions.cmake common/utils/copybinary.h common/utils/md5.c Branch: default Log Message: A little cleanup. diffs (37 lines): diff --git a/cmake/monetdb-versions.cmake b/cmake/monetdb-versions.cmake --- a/cmake/monetdb-versions.cmake +++ b/cmake/monetdb-versions.cmake @@ -53,7 +53,8 @@ set(MAPI_VERSION_MINOR "2") set(MAPI_VERSION_PATCH "2") set(MAPI_VERSION "${MAPI_VERSION_MAJOR}.${MAPI_VERSION_MINOR}.${MAPI_VERSION_PATCH}") -# version of the MONETDB5 library (subdirectory monetdb5, not including extras or sql) +# version of the MONETDB5 library (subdirectory monetdb5, not including +# extras, and tools/utils/msabaoth.[ch]) set(MONETDB5_VERSION_MAJOR "35") set(MONETDB5_VERSION_MINOR "0") set(MONETDB5_VERSION_PATCH "4") diff --git a/common/utils/copybinary.h b/common/utils/copybinary.h --- a/common/utils/copybinary.h +++ b/common/utils/copybinary.h @@ -13,8 +13,6 @@ #ifndef COPYBINARY_H #define COPYBINARY_H -#include "monetdb_config.h" - typedef struct { uint8_t day; uint8_t month; diff --git a/common/utils/md5.c b/common/utils/md5.c --- a/common/utils/md5.c +++ b/common/utils/md5.c @@ -50,7 +50,7 @@ static void MD5Transform(uint32_t [4], c static void Encode(uint8_t *, const uint32_t *, unsigned int); static void Decode(uint32_t *, const uint8_t *, unsigned int); -static uint8_t PADDING[64] = { +static uint8_t const PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: default - fixes #7527
Changeset: c720b5a862df for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/c720b5a862df Modified Files: sql/server/rel_select.c sql/test/2024/Tests/distinct_from.test Branch: default Log Message: fixes #7527 diffs (95 lines): diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c --- a/sql/server/rel_select.c +++ b/sql/server/rel_select.c @@ -2804,15 +2804,42 @@ rel_logical_exp(sql_query *query, sql_re char *compare_op = n->next->data.sval; int quantifier = 0; int is_semantics = 0; + bool is_distinct_from = false; if (n->next->next->next) quantifier = n->next->next->next->data.i_val + 1; assert(quantifier == 0 || quantifier == 1 || quantifier == 2 || quantifier == 3 || quantifier == 4); if (quantifier >= 3) { + if (quantifier == 4) + is_distinct_from = true; quantifier = 0; is_semantics = 1; } + if (is_distinct_from) { + sql_exp* ls = rel_value_exp(query, &rel, lo, f|sql_farg, ek); + if (!ls) + return NULL; + sql_exp* rs = rel_value_exp(query, &rel, ro, f|sql_farg, ek); + if (!rs) + return NULL; + + bool ls_is_non_null_atom = exp_is_atom(ls) && exp_is_not_null(ls); + bool rs_is_non_null_atom = exp_is_atom(rs) && exp_is_not_null(rs); + + if (ls_is_non_null_atom || rs_is_non_null_atom) { + sql_rel* l = rel_compare(query, rel, sc, lo, ro, compare_op, f | sql_or, ek, quantifier, 0); + sql_subtype *t; + if (!(t = exp_subtype(rs_is_non_null_atom?ls:rs))) + return sql_error(sql, 01, SQLSTATE(42000) "Cannot have a parameter for IS NULL operator"); + sql_exp* e = exp_compare(sql->sa, rs_is_non_null_atom?ls:rs, exp_atom(sql->sa, atom_general(sql->sa, t, NULL, 0)), cmp_equal); + set_has_no_nil(e); + set_semantics(e); + sql_rel* r = rel_select_push_compare_exp_down(sql, rel, e, e->l, e->r, NULL, f | sql_or); + + return rel_or(sql, rel_dup(rel), l, r, NULL, NULL, NULL); + } + } /* [NOT] DISTINCT FROM */ return rel_compare(query, rel, sc, lo, ro, compare_op, f, ek, quantifier, is_semantics); diff --git a/sql/test/2024/Tests/distinct_from.test b/sql/test/2024/Tests/distinct_from.test --- a/sql/test/2024/Tests/distinct_from.test +++ b/sql/test/2024/Tests/distinct_from.test @@ -107,6 +107,28 @@ 1 1 0 +query I nosort +select s FROM foo WHERE s IS DISTINCT FROM 20; + +10 +NULL + +query I nosort +select s FROM foo WHERE s IS NOT DISTINCT FROM 20; + +20 + +query I nosort +select s FROM foo WHERE s + 10 IS DISTINCT FROM s; + +10 +20 + +query I nosort +select s FROM foo WHERE s + 10 IS NOT DISTINCT FROM s; + +NULL + statement ok create table bar(s) as values (20), (30), (NULL) @@ -176,3 +198,16 @@ 20 20 NULL NULL + +statement ok +create table baz(s int) + +query II rowsort +SELECT * FROM baz RIGHT JOIN foo ON true WHERE (1 IS DISTINCT FROM baz.s); + +NULL +10 +NULL +20 +NULL +NULL ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org
MonetDB: label - Track v->changes in merge_unions opt
Changeset: 73b32db83cbd for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/73b32db83cbd Modified Files: sql/server/rel_optimize_proj.c Branch: label Log Message: Track v->changes in merge_unions opt diffs (11 lines): diff --git a/sql/server/rel_optimize_proj.c b/sql/server/rel_optimize_proj.c --- a/sql/server/rel_optimize_proj.c +++ b/sql/server/rel_optimize_proj.c @@ -3480,6 +3480,7 @@ rel_merge_unions(visitor *v, sql_rel *re rel_destroy(i); if (!next) next = l->h; + v->changes++; } n = next; } ___ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org