Details
Description
When a BIT column has a UNIQUE key, a predicate comparing that column to a string literal behaves incorrectly, leading to rows being improperly filtered from the result set. The bug is triggered by the presence of the UNIQUE key.
The inconsistency is evident when comparing the output of a WHERE clause filter against a direct evaluation of the same boolean expression in a SELECT list. The latter correctly computes the result for all rows, while the former does not.
CREATE TABLE t0 ( c2 BIT(7), UNIQUE (c2)) ; |
INSERT INTO t0 (c2) VALUES (b'1100011'); |
INSERT INTO t0 (c2) VALUES (b'0010110'); |
 |
SELECT c2 AS ca1 FROM t0 WHERE (NOT (('9') >= (c2))); |
-- return 1100011
|
SELECT SUM(count) FROM (SELECT ((NOT (('9') >= (c2)))) IS TRUE AS count FROM t0) AS ta_norec; |
-- return 2 |
Attachments
Issue Links
- relates to
-
MDEV-36389 Incorrect query results for an indexed text column
-
- In Review
-
-
MDEV-37622 Wrong result when casting to BINARY(7)
-
- Closed
-