Wrong result with derived table, impossible where , derived_merge=on and EXISTS in maria-5.3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Igor Babaev |
Bug Description
Requires derived_merge=on .Not repeatable before WL#106 .
The following query
SELECT *
FROM (SELECT * FROM t2 ) AS alias1
WHERE EXISTS (
SELECT t3.f2
FROM t3 , t1
WHERE t1.f3 = t3.f3
AND alias1.f2 != 0
) ;
returns no rows when executed with derived merge and 1 row when executed with no derived table or with derived_merge=off.
Explain:
| 1 | PRIMARY | t2 | ALL | NULL | NULL | NULL | NULL | 2 | Using where |
| 3 | DEPENDENT SUBQUERY | NULL | NULL | NULL | NULL | NULL | NULL | NULL | Impossible WHERE noticed after reading const tables |
minimal optimizer switch: derived_merge=off
entire optimizer_switch:
index_merge=
test case:
CREATE TABLE t1 ( f3 int) ;
INSERT IGNORE INTO t1 VALUES (8),(0);
CREATE TABLE t2 ( f2 int) ;
INSERT IGNORE INTO t2 VALUES (4),(NULL);
CREATE TABLE t3 ( f2 int, f3 int) ;
INSERT IGNORE INTO t3 VALUES (7,8);
SELECT *
FROM (SELECT * FROM t2 ) AS alias1
WHERE EXISTS (
SELECT t3.f2
FROM t3 , t1
WHERE t1.f3 = t3.f3
AND alias1.f2 != 0
) ;
Changed in maria: | |
status: | New → Confirmed |
importance: | Undecided → High |
Changed in maria: | |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
bzr version-info
revision-id: <email address hidden>
date: 2011-07-06 10:30:51 +0400
build-date: 2011-07-06 17:33:36 +0300
revno: 3085
branch-nick: maria-5.3