[MDEV-14071] Wildly wrong result from subquery in WHERE clause Created: 2017-10-14 Updated: 2017-11-11 Resolved: 2017-11-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.2.9 |
| Fix Version/s: | 10.2.11 |
| Type: | Bug | Priority: | Major |
| Reporter: | Dean Trower | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
This might be the same bug as Consider the testcase below:
All four SELECTs should produce exactly the same results, but I'm getting:
from the first two SELECTs (which is wildly wrong!), and
from the last two (which is the correct output). It's almost as if
in the first SELECT is erroneously somehow becoming:
...except that each "656" is still generating a unique row in the output (which the IN (656,656,...) wouldn't actually do). This is a pretty basic thing to be going so badly wrong, and it has actually affected my client in production code, so I think it's a pretty darn serious bug!!! (I'm not certain and don't have an alternate DB to test against, but since it's only been reported by them since upgrading to v10.2, I think it probably didn't occur in v10.1...?) |
| Comments |
| Comment by Elena Stepanova [ 2017-10-23 ] | ||||||||||||||||||||||||||||||||||
|
Dean T, thanks for the report and test case. The workaround could be using orderby_uses_equalities=off Reproducible on 10.2 with InnoDB, not reproducible with MyISAM.
| ||||||||||||||||||||||||||||||||||
| Comment by Dean Trower [ 2017-10-23 ] | ||||||||||||||||||||||||||||||||||
|
I just tested this in MariaDB v10.2.7 under Windows 10 x64, and IT DID NOT OCCUR. | ||||||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2017-11-11 ] | ||||||||||||||||||||||||||||||||||
|
A test case for this bug was pushed into 10.2 |