Diverging results with partial_match_rowid_merge=on
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Timour Katchaounov |
Bug Description
Even after the fix for mysql bug 51070, the following 2 queries return different results for no apparent reason when executed with partial_
SELECT * FROM t1 WHERE ( 6 , 4 ) NOT IN ( SELECT b , a FROM t2 );
SELECT * FROM t1 WHERE ( 6 , 4 ) NOT IN ( SELECT a , b FROM t2 );
Either the two queries must return no rows because NOT IN involving NULLs is NULL and thus FALSE, or they should both return rows because (6, 4) is actually not present in t2.
test case:
CREATE TABLE t1 (c int) ;
INSERT INTO t1 VALUES (0),(0);
CREATE TABLE t2 (a int, b int) ;
INSERT INTO t2 VALUES (6,3), (9,NULL);
SET SESSION optimizer_
SELECT * FROM t1 WHERE ( 6 , 4 ) NOT IN ( SELECT b , a FROM t2 );
SELECT * FROM t1 WHERE ( 6 , 4 ) NOT IN ( SELECT a , b FROM t2 );
The counters show that a different strategy is chosen for each query. Explain is identical:
| 1 | PRIMARY | t1 | ALL | NULL | NULL | NULL | NULL | 2 | |
| 2 | SUBQUERY | t2 | system | NULL | NULL | NULL | NULL | 1 | |
minimal optimizer switch:
full optimizer switch:
index_merge=
bzr version-info
revision-id: <email address hidden>
date: 2011-07-11 10:56:48 -0700
build-date: 2011-07-12 14:20:57 +0300
revno: 3100
branch-nick: maria-5.3
Changed in maria: | |
milestone: | none → 5.3 |
assignee: | nobody → Timour Katchaounov (timour) |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
The second query produces wrong result. The needed switch is: switch= 'materializatio n=on,partial_ match_rowid_ merge=on, partial_ match_table_ scan=off, in_to_exists= off';
SET SESSION optimizer_