[MDEV-2514] LP:967242 - Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria Created: 2012-03-28 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following query SELECT t2_1.b on the test data returns multiple rows for some values of t2_1.b, which should not be happening because of GROUP BY. bzr version-info Notes: EXPLAIN with minimal optimizer switch – all OFFs except for in_to_exists (wrong result): id select_type table type possible_keys key key_len ref rows filtered Extra Minimal optimizer_switch: in_to_exists=on Test case: SET optimizer_switch = 'in_to_exists=on'; CREATE TABLE t1 ( a VARCHAR(1) ) ENGINE=MyISAM; CREATE TABLE t2 ( b INT, c VARCHAR(1), KEY (c, b) ) ENGINE=MyISAM; SELECT t2_1.b
|
| Comments |
| Comment by Elena Stepanova [ 2012-03-28 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, subquery and OR in WHERE, MyISAM or Aria |
| Comment by Oleksandr Byelkin [ 2012-04-09 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, subquery and OR in WHERE, MyISAM or Aria CREATE TABLE t1 ( a VARCHAR(1) ) ENGINE=MyISAM; |
| Comment by Oleksandr Byelkin [ 2012-04-09 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria |
| Comment by Oleksandr Byelkin [ 2012-04-09 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria |
| Comment by Oleksandr Byelkin [ 2012-04-09 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria |
| Comment by Oleksandr Byelkin [ 2012-04-29 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria SELECT t2_1.b as zzz |
| Comment by Oleksandr Byelkin [ 2012-04-29 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria |
| Comment by Oleksandr Byelkin [ 2012-04-29 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria |
| Comment by Oleksandr Byelkin [ 2012-04-29 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria |
| Comment by Oleksandr Byelkin [ 2012-04-29 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria |
| Comment by Oleksandr Byelkin [ 2012-04-29 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria |
| Comment by Oleksandr Byelkin [ 2012-04-29 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria Here is visible how we get this triple equality: WHERE:(original) ((((`test`.`t2_1`.`b` + 1) > 0) or (`test`.`t1`.`a` = `test`.`t2_1`.`c`)) and (`test`.`t2_2`.`b` = `test`.`t2_1`.`b`) and (`test`.`t2_2`.`c` = `test`.`t2_1`.`c`)) WHERE:(after equal_items) ((((`test`.`t2_1`.`b` + 1) > 0) or multiple equal(`test`.`t2_2`.`c`, `test`.`t2_1`.`c`, `test`.`t1`.`a`)) and multiple equal(`test`.`t2_2`.`b`, `test`.`t2_1`.`b`) and multiple equal(`test`.`t2_2`.`c`, `test`.`t2_1`.`c`)) WHERE:(after const change) ((((`test`.`t2_1`.`b` + 1) > 0) or multiple equal(`test`.`t2_2`.`c`, `test`.`t2_1`.`c`, `test`.`t1`.`a`)) and multiple equal(`test`.`t2_2`.`b`, `test`.`t2_1`.`b`) and multiple equal(`test`.`t2_2`.`c`, `test`.`t2_1`.`c`)) WHERE:(after remove) ((((`test`.`t2_1`.`b` + 1) > 0) or multiple equal(`test`.`t2_2`.`c`, `test`.`t2_1`.`c`, `test`.`t1`.`a`)) and multiple equal(`test`.`t2_2`.`b`, `test`.`t2_1`.`b`) and multiple equal(`test`.`t2_2`.`c`, `test`.`t2_1`.`c`)) |
| Comment by Oleksandr Byelkin [ 2012-05-15 ] |
|
Re: Wrong result (extra rows, not grouped) with JOIN, AND in ON condition, multi-part key, GROUP BY, OR in WHERE, MyISAM or Aria |
| Comment by Rasmus Johansson (Inactive) [ 2012-05-15 ] |
|
Launchpad bug id: 967242 |