A query with LEFT JOIN returns a wrong result in mariadb 5.3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Igor Babaev |
Bug Description
The following slightly modified test case for mysql bug #58456 produces a wrong result in mariadb-5.3.5
CREATE TABLE t1 (
col_int INT,
col_int_key INT,
pk INT NOT NULL,
PRIMARY KEY (pk),
KEY col_int_key (col_int_key)
) ENGINE=InnoDB;
INSERT INTO t1 VALUES (NULL,1,1), (6,2,2), (5,3,3), (NULL,4,4);
INSERT INTO t1 VALUES (1,NULL,6), (8,5,7), (NULL,8,8), (8,NULL,5);
CREATE TABLE t2 (
pk INT PRIMARY KEY
) ENGINE=InnoDB;
INSERT INTO t2 VALUES (3), (8), (5);
SELECT t1.pk
FROM t2 LEFT JOIN t1 ON t2.pk = t1.col_int
WHERE t1.col_int_key BETWEEN 5 AND 6
AND t1.pk IS NULL OR t1.pk IN (5)
ORDER BY pk;
DROP TABLE t1,t2;
The SELECT of the test case returns an empty set though the expected result is:
+----+
| pk |
+----+
| 5 |
+----+
Changed in maria: | |
milestone: | none → 5.3 |
assignee: | nobody → Igor Babaev (igorb-seattle) |
importance: | Undecided → High |
status: | New → Confirmed |
Changed in maria: | |
status: | In Progress → Fix Committed |
The problem can be reproduced with myisam tables as well.