summaryrefslogtreecommitdiff
path: root/mysql-test/main/join_outer.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/join_outer.test')
-rw-r--r--mysql-test/main/join_outer.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test
index 82c7b265b56..304a49097c7 100644
--- a/mysql-test/main/join_outer.test
+++ b/mysql-test/main/join_outer.test
@@ -2336,6 +2336,30 @@ WHERE t3.pk IN (2);
drop view v4;
drop table t1,t2,t3,t4;
+--echo #
+--echo # MDEV-27624 Wrong result for nested left join,
+--echo # 'not exists' optimization and join buffers
+--echo #
+
+CREATE TABLE t1 (a INT NOT NULL, b INT, c INT);
+INSERT INTO t1 VALUES (1,1,1), (1,2,1), (1,3,1);
+
+CREATE TABLE t2(a INT NOT NULL);
+INSERT INTO t2 VALUES (1), (2);
+
+CREATE TABLE t3(a INT not null, b INT);
+INSERT INTO t3 VALUES (1, 1), (2, 1), (3, 1);
+
+SELECT *
+ FROM (t1 LEFT JOIN (t2 LEFT JOIN t3 ON t2.a = t3.b)
+ ON (t2.a = 1 AND (
+ t3.b = t1.a AND t3.a > t1.b OR t3.a is NULL)
+ )
+ )
+WHERE t1.c = 1 AND t3.a is NULL;
+
+DROP TABLE t1, t2, t3;
+
--echo # end of 10.3 tests
SET optimizer_switch=@org_optimizer_switch;