[MDEV-13994] Bad join results with orderby_uses_equalities=on Created: 2017-10-04 Updated: 2020-07-09 Resolved: 2017-11-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Subquery, Optimizer |
| Affects Version/s: | 10.2.5, 10.2.7, 10.2.9, 10.3.1 |
| Fix Version/s: | 10.2.11 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Jan Willem | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Official mariadb docker versions |
||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Sprint: | 10.2.11 | ||||||||||||||||||||||||
| Description |
The result should be (707, 11768), but it results in (505, 11745). Changing the engine for the books table to InnoDB, resolves the problem. Removing the library_idx on books also resolves the problem. I also tested on mysql 5.5.57, 5.6.37, 5.7.19, and mariadb 5.5.57, 10.0.32 and 10.1.28, where the problem does not occur. I've added `script.sql` containing the sql from above, and a wrapper script `reproduce.sh` to set up a docker environment for testing. |
| Comments |
| Comment by Elena Stepanova [ 2017-10-08 ] | ||||||||||||||||||||||||||||||||||||||
|
Thanks for the report and test case. For a workaround, try setting optimizer_switch='orderby_uses_equalities=off'. Same test case as in script.sql, suitable for MTR:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2017-11-08 ] | ||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2017-11-11 ] | ||||||||||||||||||||||||||||||||||||||
|
A fix for this bug was pushed into 10.2. |