Details
-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 5.5, 10.0, 10.1
-
Fix Version/s: 10.1.7
-
Component/s: Optimizer
-
Labels:
Description
This script:
SET NAMES latin1;
|
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a VARCHAR(10));
|
INSERT INTO t1 VALUES ('a'),('A'),('b'),('B'),('c'),('C');
|
SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin;
|
returns 3 rows:
+------+
|
| a |
|
+------+
|
| a |
|
| b |
|
| c |
|
+------+
|
So far so good.
If I make the condition stricter:
SELECT * FROM t1 WHERE a BETWEEN 'a' AND 'c' COLLATE latin1_bin AND a='a';
|
it returns 2 rows:
+------+
|
| a |
|
+------+
|
| a |
|
| A |
|
+------+
|
The above result is incorrect. It should return only one row, with 'a' (lower case).