Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
The following test case (for LP BUG#609121) extracted from subselect_mat.test:
create table t1 (c1 int);
create table t2 (c2 int);
insert into t1 values (1);
insert into t2 values (2);
SELECT SUM(c1) c1_sum FROM t1 WHERE c1 IN (SELECT c2 FROM t2) HAVING c1_sum;
incorrectly produces a NULL instead of an empty result.
Re: Empty query with SUM and HAVING, no GROUP BY returns NULL instead of empty result.
The bug is present both with MATERIALIZATION and with IN-TO-EXISTS,
but not with SEMIJOIN:
set @@optimizer_switch='materialization=on,in_to_exists=on,semijoin=off';
set @@optimizer_switch='materialization=off,in_to_exists=on,semijoin=off';
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';