[MDEV-4172] Wrong result (missing row, NULL instead of a field value) with semijoin=on, LEFT JOIN in the outer query and INNER JOIN in EXISTS subquery Created: 2013-02-15 Updated: 2013-03-08 Resolved: 2013-02-25 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.1, 5.5.29 |
| Fix Version/s: | 10.0.2, 5.5.30, 5.3.13 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Description |
|
The following test case
Produces 2 rows when it's executed with exists_to_in=on:
and 3 rows without exists_to_in:
The latter result is correct. EXPLAIN with exists_to_in=on, otherwise default optimizer_switch:
|
| Comments |
| Comment by Oleksandr Byelkin [ 2013-02-15 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
transformed join (without semi-join) produces more or less expected results ... select `test`.`outer_t1`.`i1` AS `i1`,`test`.`outer_t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` `outer_t1` join (`test`.`t1` join `test`.`t3`) left join `test`.`t2` on((((`test`.`t3`.`c3` = `test`.`t1`.`c1`) and (`test`.`t2`.`c2` = `test`.`outer_t1`.`c1`)) or (`test`.`outer_t1`.`c1` > 'z'))) where (`test`.`t3`.`c3` = `test`.`t1`.`c1`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2013-02-19 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
new test suite is: CREATE TABLE t1 (i1 INT, c1 VARCHAR(1)); CREATE TABLE t2 (c2 VARCHAR(1)); CREATE TABLE t3 (c3 VARCHAR(1)); SELECT * FROM t1 outer_t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') set optimizer_switch='semijoin=off'; SELECT * FROM t1 outer_t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') drop table t1,t2,t3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2013-02-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Sergey, It looks like this bug is also a legacy bug in multiple equalities: MariaDB [test]> EXPLAIN EXTENDED SELECT * FROM t1 outer_t1 LEFT JOIN t2 ON (c2 = c1 OR c1 > 'z') WHERE outer_t1.c1 IN ( SELECT c1 FROM t1, t3 WHERE c3 = c1);
---
--- MariaDB [test]> show warnings;
------
------ I will investigate the problem. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2013-02-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The fix for the bug was pushed into the 5.3 tree on 21-02-2013 |