Changeset: e97055c37ca4 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e97055c37ca4 Branch: default Log Message:
approved output diffs (153 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 @@ -2179,11 +2179,11 @@ rel_logical_value_exp(sql_query *query, if (!rs) return NULL; - if (ls && rs && exp_is_null(ls) && exp_is_null(rs)) - return exp_convert(sql->sa, ls, exp_subtype(ls), sql_bind_localtype("bit")); - if (rel_binop_check_types(sql, rel ? *rel : NULL, ls, rs, 0) < 0) return NULL; + if (exp_is_null(ls) && exp_is_null(rs)) + return exp_atom(sql->sa, atom_general(sql->sa, sql_bind_localtype("bit"), NULL)); + ls = exp_compare_func(sql, ls, rs, compare_func(compare_str2type(compare_op), quantifier?0:need_not), quantifier); if (need_not && quantifier) ls = rel_unop_(sql, NULL, ls, NULL, "not", card_value); diff --git a/sql/test/miscellaneous/Tests/groupby_error.stable.out b/sql/test/miscellaneous/Tests/groupby_error.stable.out --- a/sql/test/miscellaneous/Tests/groupby_error.stable.out +++ b/sql/test/miscellaneous/Tests/groupby_error.stable.out @@ -151,8 +151,8 @@ stdout of test 'groupby_error` in direct % bigint # type % 1 # length #SELECT NOT ( NOT + - CAST ( NULL AS INTEGER ) NOT IN ( col0 / CAST ( col2 AS INTEGER ) - + col1 ) ) FROM tab0 AS cor0; -% .%4 # table_name -% %4 # name +% .%3 # table_name +% %3 # name % boolean # type % 5 # length [ NULL ] @@ -191,8 +191,8 @@ project ( % 2 # length [ 64 ] #SELECT 11 FROM tab1 AS cor0 LEFT JOIN tab0 ON 80 = 70; -% .%6 # table_name -% %6 # name +% .%4 # table_name +% %4 # name % tinyint # type % 2 # length [ 11 ] @@ -218,8 +218,8 @@ project ( % int, int, int # type % 1, 1, 1 # length #SELECT CAST(+ col2 * col2 AS BIGINT) FROM tab2 AS cor0 WHERE NOT - CAST ( NULL AS INTEGER ) <> - - col1 AND NOT NULL NOT BETWEEN ( NULL ) AND - 91 - - + 27 * + col2; -% sys.%2 # table_name -% %2 # name +% sys.%1 # table_name +% %1 # name % bigint # type % 1 # length #SELECT + 2 FROM tab0 AS cor0 WHERE NOT - 29 IS NULL OR NOT NULL IS NULL AND NOT NULL BETWEEN + col1 - + 60 AND + 37 * + col1 + + col0; @@ -434,21 +434,21 @@ project ( [ 1303 ] #SELECT CAST(- 4 * + COUNT ( * ) + 22 + 69 AS BIGINT) AS col2, CAST(- ( + CASE + 85 WHEN - 77 / - CAST ( + CASE - + 51 WHEN 79 THEN + 95 + 13 * ( 60 * 77 ) END AS INTEGER ) + + 82 - COUNT ( * ) * COUNT ( * ) THEN #NULL WHEN SUM ( ALL 99 ) THEN COUNT ( * ) ELSE COUNT ( * ) * - ( COUNT ( * ) ) END ) * 46 - 83 AS BIGINT); -% ., .%11 # table_name -% col2, %11 # name +% ., .%4 # table_name +% col2, %4 # name % bigint, bigint # type % 2, 3 # length [ 87, -37 ] #SELECT DISTINCT CAST(- CAST ( CASE 81 WHEN 48 - - 3 / - - 47 - - CAST ( NULL AS INTEGER ) THEN NULL WHEN COUNT ( * ) THEN + - 91 + + 43 ELSE + - 0 END AS INTEGER ) AS BIGINT) AS col0, CAST(- 27 * + 43 AS BIGINT); -% ., .%5 # table_name -% col0, %5 # name +% ., .%4 # table_name +% col0, %4 # name % bigint, bigint # type % 1, 5 # length [ 0, -1161 ] #SELECT DISTINCT CAST(66 * - + CAST ( - - COUNT ( * ) AS INTEGER ) * 54 * + CASE 68 WHEN - 56 * + CAST ( NULL AS INTEGER ) + + + 47 THEN #- 83 ELSE + 59 + - COUNT ( * ) - 26 * ( 59 ) * 11 - - + COUNT ( * ) * - 73 END + + COUNT ( * ) / + ( 86 + 19 * 90 ) AS BIGINT); -% .%7 # table_name -% %7 # name +% .%3 # table_name +% %3 # name % bigint # type % 8 # length [ 60192396 ] @@ -465,6 +465,41 @@ project ( % bigint # type % 1 # length [ 1 ] +#SELECT DISTINCT CAST(COALESCE ( + 38, - - ( - 70 ) * 52 + + 91 + - 47 ) + + CAST ( - 54 AS REAL ) / + 68 / + ( - 92 ) * - - CASE WHEN NULL >= NULL THEN COUNT ( * ) WHEN - COUNT ( * ) IS NULL +#THEN NULL ELSE NULL END * + 28 * - 58 + COUNT ( * ) + + COUNT ( * ) AS BIGINT); +% .%3 # table_name +% %3 # name +% bigint # type +% 1 # length +[ NULL ] +#SELECT DISTINCT CAST(- ( COUNT ( * ) ) / + CASE 28 * + 72 + - 45 * + 2 WHEN - 14 THEN NULL WHEN 37 THEN - COALESCE ( CASE WHEN + 17 IS NOT NULL THEN ( + ( - 39 ) ) WHEN NOT NULL = ( NULL ) +#THEN NULL ELSE 52 END, - COUNT ( * ) * - 80, + NULLIF ( CASE - 70 WHEN 48 + 63 THEN NULL ELSE 89 * + 57 END, + 15 ) + - CASE + 19 WHEN - 97 THEN + 66 + - 25 END ) * + 79 + 93 * 21 END AS BIGINT) AS col1; +% . # table_name +% col1 # name +% bigint # type +% 1 # length +[ NULL ] +#START TRANSACTION; +#CREATE TABLE "tab0" ("col0" INTEGER,"col1" INTEGER,"col2" INTEGER); +#INSERT INTO "tab0" VALUES (83, 0, 38), (26, 0, 79), (43, 81, 24); +[ 3 ] +#ROLLBACK; +#START TRANSACTION; +#CREATE TABLE tab2 ("col0" INTEGER,"col1" INTEGER,"col2" INTEGER); +#INSERT INTO tab2 VALUES(64,77,40), (75,67,58), (46,51,23); +[ 3 ] +#ROLLBACK; +#START TRANSACTION; +#CREATE TABLE t(x DECIMAL(4,1)); +#INSERT INTO t VALUES (42); +[ 1 ] +#SELECT CAST(SUM(x) / COUNT(x) AS DECIMAL(13,1)) FROM t; +% sys.%3 # table_name +% %3 # name +% decimal # type +% 15 # length +[ 42.0 ] +#ROLLBACK; # 10:56:47 > # 10:56:47 > "Done." diff --git a/sql/test/miscellaneous/Tests/simple_selects.sql b/sql/test/miscellaneous/Tests/simple_selects.sql --- a/sql/test/miscellaneous/Tests/simple_selects.sql +++ b/sql/test/miscellaneous/Tests/simple_selects.sql @@ -87,6 +87,9 @@ select cast(true as interval month); --e select cast(cast(1 as interval second) as boolean); --error, not possible select cast(cast(1 as interval month) as boolean); --error, not possible +select cast(null as blob) > cast(null as blob); + -- NULL + select substring('abc' from 1 for null); select substring('abc' from null for 2); select substring('abc' from null for null); diff --git a/sql/test/miscellaneous/Tests/simple_selects.stable.out b/sql/test/miscellaneous/Tests/simple_selects.stable.out --- a/sql/test/miscellaneous/Tests/simple_selects.stable.out +++ b/sql/test/miscellaneous/Tests/simple_selects.stable.out @@ -190,6 +190,12 @@ stdout of test 'simple_selects` in direc % double, sec_interval, int, int, int, int, int, bigint # type % 24, 5, 1, 1, 1, 1, 1, 1 # length [ 10, NULL, 2, NULL, NULL, NULL, NULL, NULL ] +#select cast(null as blob) > cast(null as blob); +% .%2 # table_name +% %2 # name +% boolean # type +% 5 # length +[ NULL ] #select substring('abc' from 1 for null); % .%2 # table_name % %2 # name _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list