1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison

Optimizer erroneously translated LEFT JOIN into INNER JOIN.
It leads to cutting rows with NULL right side. It happens
because Item_row uses not_null_tables() method form the
base(Item) class and does not calculate 'null tables'
properly. The fix is adding calculation of 'not null tables'
to Item_row.
This commit is contained in:
Sergey Glukhov
2010-03-19 10:21:37 +04:00
parent bed0948145
commit 879b705342
4 changed files with 44 additions and 2 deletions

View File

@@ -896,3 +896,21 @@ FROM t1 JOIN t2 USING( a )
GROUP BY t1.a WITH ROLLUP;
DROP TABLE t1, t2;
--echo #
--echo # Bug#51598 Inconsistent behaviour with a COALESCE statement inside an IN comparison
--echo #
CREATE TABLE t1(f1 INT, f2 INT, f3 INT);
INSERT INTO t1 VALUES (1, NULL, 3);
CREATE TABLE t2(f1 INT, f2 INT);
INSERT INTO t2 VALUES (2, 1);
EXPLAIN EXTENDED SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
SELECT * FROM t1 LEFT JOIN t2 ON t1.f2 = t2.f2
WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
DROP TABLE t1, t2;
--echo End of 5.1 tests