[MDEV-8752] Wrong result for SELECT..WHERE CASE enum_field WHEN 1 THEN 1 ELSE 0 END AND a='5' Created: 2015-09-04 Updated: 2015-09-12 Resolved: 2015-09-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0, 10.1 |
| Fix Version/s: | 10.1.7 |
| Type: | Bug | Priority: | Major |
| Reporter: | Alexander Barkov | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | propagation, upstream-not-supported | ||
| Issue Links: |
|
||||||||
| Description |
|
In this script:
all SELECT queries return the same row:
Now if I join the first and the third conditions into the same condition:
it returns empty set. The expected result is to return the same row. Another example demonstrates that CASE does not propagate equal fields when it safely could:
The above script returns:
It could safely be rewritten as:
and then remove the constant part:
|
| Comments |
| Comment by Alexander Barkov [ 2015-09-12 ] | |||||||||||
|
MySQL-5.7.8 does not support propagation in this example:
|