The committed fix for the bug is incomplete, because in the following case the result must be empty, while it isn't.
CREATE TABLE t1 (f1a int, f1b int) ; INSERT IGNORE INTO t1 VALUES (1,1),(2,2); CREATE TABLE t2 ( f2 int); INSERT IGNORE INTO t2 VALUES (3),(4); CREATE TABLE t3 (f3a int, f3b int); insert into t3 values (1,1),(2,2);
set @@optimizer_switch='materialization=on,partial_match_rowid_merge=on,partial_match_table_scan=off,in_to_exists=off';
-- wrong result with a single column: SELECT * FROM t2 WHERE (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1);
-- correct empty result with two columns: SELECT * FROM t2 WHERE (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);
The committed fix for the bug is incomplete, because in the following case the
result must be empty, while it isn't.
CREATE TABLE t1 (f1a int, f1b int) ;
INSERT IGNORE INTO t1 VALUES (1,1),(2,2);
CREATE TABLE t2 ( f2 int);
INSERT IGNORE INTO t2 VALUES (3),(4);
CREATE TABLE t3 (f3a int, f3b int);
insert into t3 values (1,1),(2,2);
set @@optimizer_ switch= 'materializatio n=on,partial_ match_rowid_ merge=on, partial_ match_table_ scan=off, in_to_exists= off';
-- wrong result with a single column:
SELECT * FROM t2 WHERE (SELECT f3a FROM t3 where f3a > 3) NOT IN (SELECT f1a FROM t1);
-- correct empty result with two columns:
SELECT * FROM t2 WHERE (SELECT f3a, f3b FROM t3 where f3a > 3) NOT IN (SELECT f1a, f1b FROM t1);