Changeset: 2806e563d360 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2806e563d360 Modified Files: sql/common/sql_types.c sql/server/rel_unnest.c sql/test/sys-schema/Tests/systemfunctions.stable.out sql/test/sys-schema/Tests/systemfunctions.stable.out.int128 Branch: typing Log Message:
merged diffs (truncated from 489 to 300 lines): diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake --- a/cmake/monetdb-toolchain.cmake +++ b/cmake/monetdb-toolchain.cmake @@ -46,7 +46,6 @@ function(monetdb_default_toolchain) MT_checkCompilerFlag("-Wvariadic-macros") MT_checkCompilerFlag("-Wstack-protector") MT_checkCompilerFlag("-fstack-protector-all") - MT_checkCompilerFlag("-Wstack-protector") MT_checkCompilerFlag("-Wpacked-bitfield-compat") MT_checkCompilerFlag("-Wsync-nand") MT_checkCompilerFlag("-Wjump-misses-init") @@ -139,7 +138,6 @@ function(monetdb_default_compiler_option add_option_if_available("-Wvariadic-macros") add_option_if_available("-Wstack-protector") add_option_if_available("-fstack-protector-all") - add_option_if_available("-Wstack-protector") add_option_if_available("-Wpacked-bitfield-compat") add_option_if_available("-Wsync-nand") add_option_if_available("-Wjump-misses-init") @@ -157,6 +155,8 @@ function(monetdb_default_compiler_option elseif(${CMAKE_C_COMPILER_ID} STREQUAL "Intel") if(WIN32) add_compile_options("/W3") + add_compile_options("/Qdiag-disable:11074") + add_compile_options("/Qdiag-disable:11075") add_compile_options("/Wcheck") add_compile_options("/Werror-all") add_compile_options("/${INTEL_OPTION_EXTRA}wd2259") diff --git a/common/stream/stream.c b/common/stream/stream.c --- a/common/stream/stream.c +++ b/common/stream/stream.c @@ -73,7 +73,7 @@ static pthread_key_t tl_error_key; static int tl_error_init(void) { - if (pthread_key_create(&tl_error_key, free) < 0) + if (pthread_key_create(&tl_error_key, free) != 0) return -1; return 0; } @@ -407,7 +407,7 @@ my_strerror_r(int error_nr, char *buf, s #ifndef HAVE_STRERROR_R // Hope for the best to_move = strerror(error_nr); -#elif (_POSIX_C_SOURCE >= 200112L) && !_GNU_SOURCE +#elif !defined(_GNU_SOURCE) || !_GNU_SOURCE // standard strerror_r always writes to buf int result_code = strerror_r(error_nr, buf, buflen); if (result_code == 0) @@ -946,4 +946,3 @@ mnstr_read_block(stream *restrict s, voi return -1; return len; } - diff --git a/monetdb5/modules/kernel/CMakeLists.txt b/monetdb5/modules/kernel/CMakeLists.txt --- a/monetdb5/modules/kernel/CMakeLists.txt +++ b/monetdb5/modules/kernel/CMakeLists.txt @@ -34,6 +34,8 @@ target_include_directories(kernel $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:${INCLUDEDIR}/monetdb>) target_include_directories(microbenchmark + PRIVATE + $<TARGET_PROPERTY:mal,INCLUDE_DIRECTORIES> PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:${INCLUDEDIR}/monetdb>) @@ -54,10 +56,8 @@ target_link_libraries(kernel target_link_libraries(microbenchmark PRIVATE monetdb_config_header - mutils bat - mal - atoms) + monetdb5) set_target_properties(kernel PROPERTIES diff --git a/monetdb5/scheduler/CMakeLists.txt b/monetdb5/scheduler/CMakeLists.txt --- a/monetdb5/scheduler/CMakeLists.txt +++ b/monetdb5/scheduler/CMakeLists.txt @@ -20,7 +20,6 @@ target_include_directories(run_adder target_link_libraries(run_adder PRIVATE monetdb_config_header - mutils bat monetdb5) set_target_properties(run_adder @@ -47,7 +46,6 @@ target_include_directories(run_isolate target_link_libraries(run_isolate PRIVATE monetdb_config_header - mutils bat monetdb5) set_target_properties(run_isolate @@ -74,7 +72,6 @@ target_include_directories(run_memo target_link_libraries(run_memo PRIVATE monetdb_config_header - mutils bat monetdb5) set_target_properties(run_memo diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c --- a/sql/backends/monet5/rel_bin.c +++ b/sql/backends/monet5/rel_bin.c @@ -675,8 +675,6 @@ exp2bin_case(backend *be, sql_exp *fe, s if (val->nrcols == 0) val = stmt_const(be, pos, val); - else if (val->cand != isel && val->cand != rsel && val->cand != nsel) - val = stmt_project(be, rsel, val); else if (!val->cand && nsel) val = stmt_project(be, nsel, val); res = stmt_replace(be, res, pos, val); @@ -694,13 +692,17 @@ exp2bin_case(backend *be, sql_exp *fe, s if (next_cond) { ncond = cond = es; if (!ncond->nrcols) { - if (osel) + if (osel) { ncond = stmt_const(be, nsel, ncond); - else if (isel) + ncond->cand = nsel; + } else if (isel) { ncond = stmt_const(be, isel, ncond); - else + ncond->cand = isel; + } else ncond = stmt_const(be, bin_first_column(be, left), ncond); } + if (isel && !ncond->cand) + ncond = stmt_project(be, nsel, ncond); stmt *s = stmt_uselect(be, ncond, stmt_bool(be, 1), cmp_equal, !ncond->cand?rsel:NULL, 0/*anti*/, 0); if (rsel && ncond->cand) rsel = stmt_project(be, s, rsel); @@ -821,10 +823,6 @@ exp2bin_coalesce(backend *be, sql_exp *f } if (val->nrcols == 0) val = stmt_const(be, pos, val); - /* - else if (val->cand != isel && val->cand != rsel && val->cand != nsel) - val = stmt_project(be, rsel, val); - */ else if (!val->cand && nsel) val = stmt_project(be, nsel, val); diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -1409,8 +1409,10 @@ sqltypeinit( sql_allocator *sa) sql_create_aggr(sa, "count_no_nil", "aggr", "count_no_nil", TRUE, LNG, 0); sql_create_aggr(sa, "count", "aggr", "count", TRUE, LNG, 1, ANY); - sql_create_aggr(sa, "listagg", "aggr", "str_group_concat", TRUE, STR, 1, STR); - sql_create_aggr(sa, "listagg", "aggr", "str_group_concat", TRUE, STR, 2, STR, STR); + for (t = strings; t < numerical; t++) { + sql_create_aggr(sa, "listagg", "aggr", "str_group_concat", TRUE, *t, 1, *t); + sql_create_aggr(sa, "listagg", "aggr", "str_group_concat", TRUE, *t, 2, *t, *t); + } /* order based operators */ sql_create_analytic(sa, "diff", "sql", "diff", SCALE_NONE, BIT, 1, ANY); @@ -1604,9 +1606,10 @@ sqltypeinit( sql_allocator *sa) sql_create_analytic(sa, "avg", "sql", "avg", SCALE_NONE, DAYINT, 1, DAYINT); sql_create_analytic(sa, "avg", "sql", "avg", SCALE_NONE, SECINT, 1, SECINT); - sql_create_analytic(sa, "listagg", "sql", "str_group_concat", SCALE_NONE, STR, 1, STR); - sql_create_analytic(sa, "listagg", "sql", "str_group_concat", SCALE_NONE, STR, 2, STR, STR); - + for (t = strings; t < numerical; t++) { + sql_create_analytic(sa, "listagg", "sql", "str_group_concat", SCALE_NONE, *t, 1, *t); + sql_create_analytic(sa, "listagg", "sql", "str_group_concat", SCALE_NONE, *t, 2, *t, *t); + } sql_create_func(sa, "and", "calc", "and", TRUE, FALSE, SCALE_FIX, 0, BIT, 2, BIT, BIT); sql_create_func(sa, "or", "calc", "or", TRUE, FALSE, SCALE_FIX, 0, BIT, 2, BIT, BIT); sql_create_func(sa, "xor", "calc", "xor", FALSE, FALSE, SCALE_FIX, 0, BIT, 2, BIT, BIT); @@ -1830,10 +1833,11 @@ sqltypeinit( sql_allocator *sa) sql_create_func(sa, "minute", "mtime", "minutes", FALSE, FALSE, SCALE_NONE, 0, INT, 1, SECINT); sql_create_func(sa, "second", "mtime", "seconds", FALSE, FALSE, SCALE_NONE, 0, INT, 1, SECINT); - sql_create_func(sa, "next_value_for", "sql", "next_value", TRUE, TRUE, SCALE_NONE, 0, LNG, 2, STR, STR); - sql_create_func(sa, "get_value_for", "sql", "get_value", TRUE, FALSE, SCALE_NONE, 0, LNG, 2, STR, STR); - sql_create_func(sa, "restart", "sql", "restart", TRUE, FALSE, SCALE_NONE, 0, LNG, 3, STR, STR, LNG); for (t = strings; t < numerical; t++) { + sql_create_func(sa, "next_value_for", "sql", "next_value", TRUE, TRUE, SCALE_NONE, 0, LNG, 2, *t, *t); + sql_create_func(sa, "get_value_for", "sql", "get_value", TRUE, FALSE, SCALE_NONE, 0, LNG, 2, *t, *t); + sql_create_func(sa, "restart", "sql", "restart", TRUE, FALSE, SCALE_NONE, 0, LNG, 3, *t, *t, LNG); + sql_create_func(sa, "index", "calc", "index", TRUE, FALSE, SCALE_NONE, 0, BTE, 2, *t, BIT); sql_create_func(sa, "index", "calc", "index", TRUE, FALSE, SCALE_NONE, 0, SHT, 2, *t, BIT); sql_create_func(sa, "index", "calc", "index", TRUE, FALSE, SCALE_NONE, 0, INT, 2, *t, BIT); diff --git a/sql/server/rel_unnest.c b/sql/server/rel_unnest.c --- a/sql/server/rel_unnest.c +++ b/sql/server/rel_unnest.c @@ -2811,7 +2811,7 @@ rewrite_ifthenelse(visitor *v, sql_rel * } static list * -rewrite_compare_exps(visitor *v, list *exps) +rewrite_compare_exps(visitor *v, sql_rel *rel, list *exps) { if (list_empty(exps)) return exps; @@ -2819,12 +2819,18 @@ rewrite_compare_exps(visitor *v, list *e sql_exp *e = n->data; if (!is_compare(e->type)) { - n->data = e = exp_compare(v->sql->sa, e, exp_atom_bool(v->sql->sa, 1), cmp_equal); + sql_subtype bt; + sql_find_subtype(&bt, "boolean", 0, 0); + if (!(e = exp_check_type(v->sql, &bt, rel, e, type_equal))) + return NULL; + n->data = exp_compare(v->sql->sa, e, exp_atom_bool(v->sql->sa, 1), cmp_equal); v->changes++; } if (is_compare(e->type) && e->flag == cmp_or) { - e->l = rewrite_compare_exps(v, e->l); - e->r = rewrite_compare_exps(v, e->r); + if (!(e->l = rewrite_compare_exps(v, rel, e->l))) + return NULL; + if (!(e->r = rewrite_compare_exps(v, rel, e->r))) + return NULL; } } list_hash_clear(exps); @@ -2836,7 +2842,8 @@ static sql_rel * rewrite_compare_exp(visitor *v, sql_rel *rel) { if ((is_select(rel->op) || is_join(rel->op) || is_semi(rel->op)) && !list_empty(rel->exps)) - rel->exps = rewrite_compare_exps(v, rel->exps); + if (!(rel->exps = rewrite_compare_exps(v, rel, rel->exps))) + return NULL; return rel; } diff --git a/sql/test/SQLancer/Tests/sqlancer05.sql b/sql/test/SQLancer/Tests/sqlancer05.sql --- a/sql/test/SQLancer/Tests/sqlancer05.sql +++ b/sql/test/SQLancer/Tests/sqlancer05.sql @@ -210,3 +210,61 @@ THEN NOT ((t1.c0) BETWEEN ASYMMETRIC (t1 as res; -- 0 ROLLBACK; + +START TRANSACTION; +CREATE TABLE "sys"."t0" ("c0" DOUBLE, "c1" TIMESTAMP, + CONSTRAINT "t0_c0_unique" UNIQUE ("c0"), + CONSTRAINT "t0_c1_unique" UNIQUE ("c1"), + CONSTRAINT "t0_c0_c1_unique" UNIQUE ("c0", "c1"), + CONSTRAINT "t0_c0_fkey" FOREIGN KEY ("c0") REFERENCES "sys"."t0" ("c0") +); +COPY 4 RECORDS INTO "sys"."t0" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +NULL "1970-01-19 09:37:48.000000" +NULL "1970-01-25 15:39:05.000000" +NULL "1970-01-25 02:16:22.000000" +NULL "1970-01-20 18:57:37.000000" + +CREATE TABLE "sys"."t1" ("c0" DOUBLE,"c1" TIMESTAMP); +COPY 5 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +NULL "1970-01-17 22:34:50.000000" +NULL "1970-01-21 20:17:49.000000" +0.5197361696675626 NULL +0.46979060080234214 NULL +0.0047394257892724445 NULL + +SELECT t0.c1 FROM t0 WHERE (((((t0.c0) NOT IN (-1003666733, t0.c0))OR((t0.c0) NOT BETWEEN SYMMETRIC (((14)*(10))) AND (- (75)))))OR('TRUE')); + -- 1970-01-19 09:37:48 + -- 1970-01-25 15:39:05 + -- 1970-01-25 02:16:22 + -- 1970-01-20 18:57:37 + +SELECT CAST(SUM(count) AS BIGINT) FROM (SELECT CAST((((((t0.c0) NOT IN (-10, t0.c0))OR((t0.c0) NOT BETWEEN SYMMETRIC (((14)*(10))) AND (- (756050096)))))OR('TRUE')) AS INT) as count FROM t0) as res; + -- 4 +ROLLBACK; + +START TRANSACTION; +CREATE TABLE "sys"."t1" ( + "c0" CHAR(420) NOT NULL, + CONSTRAINT "t1_c0_pkey" PRIMARY KEY ("c0") +); +COPY 14 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"'; +"-1284014837" +"R/<" +"" +"s2" +")L" +"-1637493938" +"0.7778392099491236" +"w" +"-\\h" +"d" +"mfvgds&o" +"449949101" +"f8i8c" +"?" + +SELECT t1.c0 FROM t1 WHERE t1.c0 NOT ILIKE t1.c0; + --empty _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list