[MDEV-367] Different results with and without subquery_cache on a query with a constant NOT IN condition Created: 2012-06-25 Updated: 2012-08-27 Due: 2012-08-23 Resolved: 2012-08-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 5.5.25, 5.3.7 |
| Fix Version/s: | 5.5.27, 5.3.8 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The following query
returns an empty result set with the default optimizer_switch (where subquery_cache=ON), and some rows with subquery_cache=OFF. I believe that the empty result set is correct, because all `a` values are less than 100, and the other part of the WHERE condition evaluates as NULL. bzr version-info
mysql-trunk with the default optimizer_switch also returns rows. EXPLAIN with the default optimizer_switch (subquery_cache=on):
EXPLAIN with subquery_cache=off:
Test case:
Result:
|
| Comments |
| Comment by Oleksandr Byelkin [ 2012-07-17 ] |
|
I see why cache fixes the problem - only the first result is correct: SELECT *, ( 3, 3 ) NOT IN ( SELECT NULL, NULL ) FROM t1; |
| Comment by Oleksandr Byelkin [ 2012-07-17 ] |
|
So it returns incorrect result on second call when NULL is important (that is why the original test suite require OR). |
| Comment by Oleksandr Byelkin [ 2012-07-17 ] |
|
The problem is that was_null does not survive over reinitializtion and is not set again because query is constant so it executed only once... I see 3 ways to fix it |
| Comment by Oleksandr Byelkin [ 2012-07-17 ] |
|
I used way 2) (from above) Commit e-mail subject line is: |
| Comment by Oleksandr Byelkin [ 2012-08-25 ] |
|
Pushed to 5.3 (waiting for buildbot) |
| Comment by Oleksandr Byelkin [ 2012-08-27 ] |
|
Pushed to 5.3 |
| Comment by Oleksandr Byelkin [ 2012-08-27 ] |
|
Pushed to 5.3, checked in buildbot |