Loading mysql-test/r/subselect.result +15 −0 Original line number Diff line number Diff line Loading @@ -2835,6 +2835,21 @@ a 4 DROP TABLE t1,t2,t3; purge master logs before (select adddate(current_timestamp(), interval -4 day)); CREATE TABLE t1 (f1 INT); CREATE TABLE t2 (f2 INT); INSERT INTO t1 VALUES (1); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2); f1 1 SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE 1=0); f1 1 INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (2); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE f2=0); f1 1 DROP TABLE t1, t2; select 1 from dual where 1 < any (select 2); 1 1 Loading mysql-test/t/subselect.test +14 −0 Original line number Diff line number Diff line Loading @@ -1821,6 +1821,20 @@ DROP TABLE t1,t2,t3; purge master logs before (select adddate(current_timestamp(), interval -4 day)); # # Bug#18503: Queries with a quantified subquery returning empty set may # return a wrong result. # CREATE TABLE t1 (f1 INT); CREATE TABLE t2 (f2 INT); INSERT INTO t1 VALUES (1); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE 1=0); INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (2); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE f2=0); DROP TABLE t1, t2; # # Bug#16302: Quantified subquery without any tables gives wrong results # Loading sql/sql_select.cc +5 −0 Original line number Diff line number Diff line Loading @@ -6780,8 +6780,13 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), { if (!join->first_record) { List_iterator_fast<Item> it(*join->fields); Item *item; /* No matching rows for group function */ join->clear(); while ((item= it++)) item->no_rows_in_result(); } if (join->having && join->having->val_int() == 0) error= -1; // Didn't satisfy having Loading Loading
mysql-test/r/subselect.result +15 −0 Original line number Diff line number Diff line Loading @@ -2835,6 +2835,21 @@ a 4 DROP TABLE t1,t2,t3; purge master logs before (select adddate(current_timestamp(), interval -4 day)); CREATE TABLE t1 (f1 INT); CREATE TABLE t2 (f2 INT); INSERT INTO t1 VALUES (1); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2); f1 1 SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE 1=0); f1 1 INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (2); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE f2=0); f1 1 DROP TABLE t1, t2; select 1 from dual where 1 < any (select 2); 1 1 Loading
mysql-test/t/subselect.test +14 −0 Original line number Diff line number Diff line Loading @@ -1821,6 +1821,20 @@ DROP TABLE t1,t2,t3; purge master logs before (select adddate(current_timestamp(), interval -4 day)); # # Bug#18503: Queries with a quantified subquery returning empty set may # return a wrong result. # CREATE TABLE t1 (f1 INT); CREATE TABLE t2 (f2 INT); INSERT INTO t1 VALUES (1); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE 1=0); INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (2); SELECT * FROM t1 WHERE f1 > ALL (SELECT f2 FROM t2 WHERE f2=0); DROP TABLE t1, t2; # # Bug#16302: Quantified subquery without any tables gives wrong results # Loading
sql/sql_select.cc +5 −0 Original line number Diff line number Diff line Loading @@ -6780,8 +6780,13 @@ end_send_group(JOIN *join, JOIN_TAB *join_tab __attribute__((unused)), { if (!join->first_record) { List_iterator_fast<Item> it(*join->fields); Item *item; /* No matching rows for group function */ join->clear(); while ((item= it++)) item->no_rows_in_result(); } if (join->having && join->having->val_int() == 0) error= -1; // Didn't satisfy having Loading