Changeset: 72f405713931 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=72f405713931
Modified Files:
sql/backends/monet5/rel_bin.c
sql/test/SQLancer/Tests/sqlancer09.sql
sql/test/SQLancer/Tests/sqlancer09.stable.out
Branch: Oct2020
Log Message:
SQLancer crash and fix, ie do a stronger check for cardinality on the right
side of the filter
diffs (133 lines):
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
@@ -1199,7 +1199,7 @@ exp_bin(backend *be, sql_exp *e, stmt *l
}
r = stmt_list(be, ops);
- if (left && right && exps_card(e->r) > CARD_ATOM) {
+ if (left && right && (exps_card(e->r) != CARD_ATOM ||
!exps_are_atoms(e->r))) {
sql_subfunc *f = e->f;
return stmt_genjoin(be, l, r, f, is_anti(e),
swapped);
}
diff --git a/sql/test/SQLancer/Tests/sqlancer09.sql
b/sql/test/SQLancer/Tests/sqlancer09.sql
--- a/sql/test/SQLancer/Tests/sqlancer09.sql
+++ b/sql/test/SQLancer/Tests/sqlancer09.sql
@@ -68,9 +68,9 @@ 10:35:38 NULL
04:26:50 NULL
CREATE TABLE "sys"."t1" ("c0" CHAR(375) NOT NULL, CONSTRAINT "t1_c0_pkey"
PRIMARY KEY ("c0"), CONSTRAINT "t1_c0_fkey" FOREIGN KEY ("c0") REFERENCES
"sys"."t0" ("c1"));
-insert into t1 values ('');
-insert into t1(c0) values ((select 'a')), ('b');
-insert into t1(c0) values(r']BW扗}FUp'), (cast((values (greatest(r'Aᨐ', r'_')))
as string(616))), (r'');
+--insert into t1 values ('');
+--insert into t1(c0) values ((select 'a')), ('b');
+--insert into t1(c0) values(r']BW扗}FUp'), (cast((values (greatest(r'Aᨐ',
r'_'))) as string(616))), (r'');
ROLLBACK;
START TRANSACTION;
@@ -107,3 +107,39 @@ INSERT INTO t2(c0) VALUES((((((((least(r
INSERT INTO t2 VALUES (COALESCE(1 BETWEEN 2 AND 3, 1));
ROLLBACK;
+
+START TRANSACTION;
+CREATE TABLE "sys"."t1" ("c0" DOUBLE NOT NULL,CONSTRAINT "t1_c0_pkey" PRIMARY
KEY ("c0"),CONSTRAINT "t1_c0_unique" UNIQUE ("c0"));
+COPY 10 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+0.19726593583228624
+0.3617077941904526
+0.09499147053563461
+0.9165351565675044
+0.4849843626674083
+-788116199
+-2039978642
+0.1344643786448907
+0
+1
+
+create view v0(vc0, vc1, vc2) as (values (+ (((0.55)*(2))),
+case when ((r'ꠔJ''6H*')=(r'\_fhsQh1?')) then case when true then -32 else 77
end else + (-1) end, (least(33.0,
+0.34670544)) not between symmetric (cast(-2 as smallint)) and
(((0.33)/(48)))));
+create view v2(vc0) as (select scale_down(- (-1.2), greatest(0.54, 5)) where
((((((false)or(true)))
+and(false)))and(false)));
+create view v5(vc0, vc1) as (select distinct ifthenelse(case when false then
false when false then false end, r'YK隆', r'᳖g# .&'),
+round(+ (-5), scale_down(0.4, 5)) where "isauuid"(r'')) with check option;
+create view v6(vc0) as (values (- (((61)-(2))))) with check option;
+create view v7(vc0) as (values (case when case when true then true when true
then false when true then false else false end
+then lower(r'mEqP') when (1549) is null then upper(r'o]hUWA쪬') end));
+
+select cast(sum(count) as bigint) from (select all cast(((case when v0.vc2
then v0.vc2 end)or((v7.vc0) not between
+symmetric (v7.vc0) and (v7.vc0))) as int) as count from v2, v7 right outer
join v0 on
+((nullif(v7.vc0, v7.vc0))not ilike(cast(v0.vc0 as string(804)))) join
+(values (greatest(110, -2)), (((least(2, 9942))%(cast(r'1' as int)))),
+(case true when "isauuid"(r'H}m0YfN') then 0.3 else sign(0.4) end))
+as sub0 on v0.vc2 full outer join (select scale_up(least(0.4, -3),
+scale_down(v2.vc0, 0.4)), 0.4, 0.4
+from v2, v5, v6 where greatest(true, true)) as sub1 on true right outer join
+(select r'-1216996046' from t1 where (true) is null) as sub2 on (v0.vc2) not
in (v0.vc2, v0.vc2, false, v0.vc2)) as res;
+ROLLBACK;
diff --git a/sql/test/SQLancer/Tests/sqlancer09.stable.out
b/sql/test/SQLancer/Tests/sqlancer09.stable.out
--- a/sql/test/SQLancer/Tests/sqlancer09.stable.out
+++ b/sql/test/SQLancer/Tests/sqlancer09.stable.out
@@ -91,13 +91,13 @@ stdout of test 'sqlancer09` in directory
#WHEN TRUE THEN 1702709680 WHEN r'TRUE' THEN 1255285064 END
[ 4 ]
#SELECT 1 FROM (SELECT 1 FROM v0) AS v0(v0) inner join t1 ON 1 BETWEEN 2 AND 1;
-% .%11 # table_name
-% %11 # name
+% .%3 # table_name
+% %3 # name
% tinyint # type
% 1 # length
#SELECT 1 FROM (SELECT 1 FROM v0) AS v0(v0) inner join t1 ON 1 BETWEEN 2 AND
(CASE WHEN 1 BETWEEN 2 AND 3 THEN 2 END);
-% .%12 # table_name
-% %12 # name
+% .%4 # table_name
+% %4 # name
% tinyint # type
% 1 # length
#ROLLBACK;
@@ -106,6 +106,43 @@ stdout of test 'sqlancer09` in directory
#INSERT INTO t2(c0) VALUES((((((((least(r' ]', r'3''')) IS
NULL)OR((((TIMESTAMP '1969-12-20 19:22:32') BETWEEN SYMMETRIC (TIMESTAMP
'1969-12-29 05:03:02') AND (TIMESTAMP '1970-01-14 15:38:43'))OR(CASE FALSE WHEN
FALSE THEN TRUE WHEN TRUE THEN TRUE WHEN FALSE THEN FALSE WHEN FALSE THEN TRUE
ELSE TRUE END)))))OR(COALESCE((TIMESTAMP '1969-12-11 14:58:21') BETWEEN
SYMMETRIC (TIMESTAMP '1970-01-09 21:56:14') AND (TIMESTAMP '1970-01-01
01:00:14'), ((0.26488915)>(1.345373227E9)), sql_min(FALSE,
TRUE)))))AND("isauuid"(r'45456452')))), (TRUE);
[ 2 ]
#ROLLBACK;
+#START TRANSACTION;
+#CREATE TABLE "sys"."t1" ("c0" DOUBLE NOT NULL,CONSTRAINT "t1_c0_pkey" PRIMARY
KEY ("c0"),CONSTRAINT "t1_c0_unique" UNIQUE ("c0"));
+#COPY 10 RECORDS INTO "sys"."t1" FROM stdin USING DELIMITERS E'\t',E'\n','"';
+#0.19726593583228624
+#0.3617077941904526
+#0.09499147053563461
+#0.9165351565675044
+#0.4849843626674083
+#-788116199
+#-2039978642
+#0.1344643786448907
+#0
+#1
+[ 10 ]
+#create view v0(vc0, vc1, vc2) as (values (+ (((0.55)*(2))),
+#case when ((r'ꠔJ''6H*')=(r'\_fhsQh1?')) then case when true then -32 else 77
end else + (-1) end, (least(33.0,
+#0.34670544)) not between symmetric (cast(-2 as smallint)) and
(((0.33)/(48)))));
+#create view v2(vc0) as (select scale_down(- (-1.2), greatest(0.54, 5)) where
((((((false)or(true)))
+#and(false)))and(false)));
+#create view v5(vc0, vc1) as (select distinct ifthenelse(case when false then
false when false then false end, r'YK隆', r'᳖g# .&'),
+#round(+ (-5), scale_down(0.4, 5)) where "isauuid"(r'')) with check option;
+#create view v6(vc0) as (values (- (((61)-(2))))) with check option;
+#create view v7(vc0) as (values (case when case when true then true when true
then false when true then false else false end
+#then lower(r'mEqP') when (1549) is null then upper(r'o]hUWA쪬') end));
+#select cast(sum(count) as bigint) from (select all cast(((case when v0.vc2
then v0.vc2 end)or((v7.vc0) not between
+#symmetric (v7.vc0) and (v7.vc0))) as int) as count from v2, v7 right outer
join v0 on
+#((nullif(v7.vc0, v7.vc0))not ilike(cast(v0.vc0 as string(804)))) join
+#(values (greatest(110, -2)), (((least(2, 9942))%(cast(r'1' as int)))),
+#(case true when "isauuid"(r'H}m0YfN') then 0.3 else sign(0.4) end))
+#as sub0 on v0.vc2 full outer join (select scale_up(least(0.4, -3),
+#scale_down(v2.vc0, 0.4)), 0.4, 0.4
+% .%35 # table_name
+% %35 # name
+% bigint # type
+% 1 # length
+[ NULL ]
+#ROLLBACK;
# 14:35:03 >
# 14:35:03 > "Done."
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list