Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1.6, 5.5(EOL), 10.0(EOL)
-
None
Description
This script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a VARCHAR(10) COLLATE latin1_bin);
|
INSERT INTO t1 VALUES ('a'),('a ');
|
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ';
|
returns one row:
+------+-----------+
|
| a | LENGTH(a) |
|
+------+-----------+
|
| a | 1 |
|
+------+-----------+
|
Now if I make the condition even stronger:
SELECT a, LENGTH(a) FROM t1 WHERE a NOT LIKE 'a ' AND a='a';
|
it erroneously returns 2 rows:
+------+-----------+
|
| a | LENGTH(a) |
|
+------+-----------+
|
| a | 1 |
|
| a | 2 |
|
+------+-----------+
|
The problem happens in equal fields propagation.
WHERE a NOT LIKE 'a ' AND a='a'
|
gets rewritten to
WHERE 'a' NOT LIKE 'a ' AND a='a'
|
then LIKE gets removed from the condition.
Attachments
Issue Links
- blocks
-
MDEV-8728 Fix a number of problems in equal field and equal expression propagation
- Closed