Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
10.11, 11.4, 11.8, 12.3, 11.8.6
-
Not for Release Notes
Description
`BOOLEAN` is `TINYINT(1)`, and inserting `127` preserves that non-canonical non-zero value. Therefore `NOT (NOT t1.c0)` is `1`, so `t1.c0 != (NOT (NOT t1.c0))` is `127 != 1`, i.e. true. MariaDB's projection evaluation reports that value as true, so the `WHERE` clause that builds `join_temp_0` should keep the row. Instead, MariaDB filters it away, and the final query incorrectly becomes empty.
How to repeat:
CREATE TABLE t0(c0 INT);
CREATE TABLE t1(c0 BOOLEAN PRIMARY KEY);
INSERT INTO t0 VALUES (0);
INSERT INTO t1 VALUES (127);
CREATE TEMPORARY TABLE join_temp_0 (c0 TINYINT(1) NOT NULL);
INSERT INTO join_temp_0 SELECT * FROM t1 WHERE (t1.c0 != (NOT (NOT t1.c0)));
SELECT MIN(t1.c0)
FROM t0 INNER JOIN join_temp_0 AS t1
ON ((t0.c0 < t1.c0) AND (t1.c0 != true))
HAVING (MIN(t1.c0) != true); – Expected correct result: 127 – actual Wrong result: <empty>
Attachments
Issue Links
- duplicates
-
MDEV-36440 Double negation is treated as original value in WHERE clause
-
- Confirmed
-
- is duplicated by
-
MDEV-39728 A BOOLEAN != NOT NOT INT predicate evaluates false in projection but true in filtering
-
- Closed
-