Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
12.2.2
-
None
-
None
-
None
Description
Hi, I found a logic bug in MariaDB 12.2.2. A query using a correlated subquery with LOCATE and a logical expression (t0.c0 IS FALSE) returns an incorrect count of 2 instead of the expected 0. Reducing the number of rows in either table makes the bug disappear.
CREATE TABLE t0(c0 REAL UNSIGNED, PRIMARY KEY(c0)); |
CREATE TABLE t1(c0 REAL ZEROFILL); |
INSERT INTO t0 SELECT seq FROM seq_0_to_40; -- 41 rows |
INSERT INTO t1 SELECT seq FROM seq_0_to_2; -- 3 rows |
SELECT COUNT(CASE WHEN NOT EXISTS (SELECT 1 FROM t1 WHERE LOCATE((t0.c0 IS FALSE), t0.c0, true) AND t0.c0 = t1.c0) THEN 1 END) FROM t0 WHERE EXISTS (SELECT 1 FROM t1 WHERE LOCATE((t0.c0 IS FALSE), t0.c0, true) AND t0.c0 = t1.c0); -- expect 0, actually return 2 |