[MDEV-17411] Wrong WHERE optimization with simple CASE and searched CASE Created: 2018-10-09 Updated: 2018-10-11 Resolved: 2018-10-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0, 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.3.11 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
WHERE optimization does not seem to distinguish between a simple CASE and a searched CASE with the same arguments. I create and populate a table:
A query with a simple CASE:
returns 3 rows. A query with a searched CASE:
returns one row. Now I combine both conditions using AND:
The expected result is to return one row, as in the second query. The condition was erroneously optimized to WHERE 0;
|