[MDEV-8747] Wrong result for SELECT..WHERE derived_table_column='a' AND derived_table_column<>_latin1'A' COLLATE latin1_bin Created: 2015-09-04 Updated: 2015-09-12 Resolved: 2015-09-06 |
|
| 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 | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
This script:
correctly returns one row:
If I rewrite the query to use a derived table:
it erroneously returns two rows:
The problems happens because Item_direct_view_ref has cmp_context correctly set to STRING_RESULT, while its referenced field has cmp_context set to IMPOSSIBLE_RESULT. This makes equal field propagation replace the field to constant in <>. The same bug causes ENUM column to return bad results:
The first and the second query correctly return one row, equal to '5'. The third query erroneously returns empty set. The same problem is also demonstrated in this script:
The first SELECT returns empty set, the second SELECT returns one row. The same problem is repeatable in this script:
The first SELECT correctly return one row, the second SELECT erroneously returns no rows. |
| Comments |
| Comment by Alexander Barkov [ 2015-09-12 ] | ||||||||||
|
MySQL-5.7.8 returns a wrong result for this script:
The correct result is to return one row only. |