[MDEV-8688] Wrong result for SELECT..WHERE varchar_column IN (1,2,3) AND varchar_column=' 1'; Created: 2015-08-28 Updated: 2015-09-12 Resolved: 2015-08-29 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 5.1.67, 5.2.14, 5.3.12, 5.5, 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 | ||
| Issue Links: |
|
||||||||
| Description |
|
This script:
returns one row:
Now if I make the condition even stroger:
It erroneously returns two rows:
It should return one row. The problem happens in equal fields propagation in this code:
Item_func_in does not set cmp_type of args[0], so has_compatible_context() passes and the field gets erroneously replaced to the string constant which makes Item_func_in::val_int() always evaluate to TRUE. |
| Comments |
| Comment by Alexander Barkov [ 2015-08-28 ] | |||||||||||||||||
|
Another example script:
returns one row:
Now if I make the condition even stronger:
it erroneously returns two rows:
|