From af4421e82d3d458ea8f19cda6376503be6c49143 Mon Sep 17 00:00:00 2001 From: Igor Babaev Date: Mon, 29 May 2017 00:27:14 -0700 Subject: Fixed the bug mdev-12931. This corrects the patch for mdev-10006. The current code supports only those semi-join nests that are placed at the join top level. So such nests cannot depend on other tables or nests. --- mysql-test/t/subselect_innodb.test | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'mysql-test/t/subselect_innodb.test') diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test index 2451bc60fee..544bcd994ed 100644 --- a/mysql-test/t/subselect_innodb.test +++ b/mysql-test/t/subselect_innodb.test @@ -576,3 +576,38 @@ from t1; drop table t1,t2; + +--echo # +--echo # mdev-12931: semi-join in ON expression of STRAIGHT_JOIN +--echo # joining a base table and a mergeable derived table +--echo # + +CREATE TABLE t1 (f1 int) ENGINE=InnoDB; +INSERT INTO t1 VALUES (3),(2); + +CREATE TABLE t2 (f2 int) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1),(4); + +CREATE TABLE t3 (f3 int) ENGINE=InnoDB; +INSERT INTO t3 VALUES (5),(6); + +CREATE TABLE t4 (f4 int) ENGINE=InnoDB; +INSERT INTO t4 VALUES (1),(8); + +SELECT * +FROM t1 + INNER JOIN + ( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq + ON ( 1 IN ( SELECT f4 FROM t4 ) ) ) + ON ( f1 >= f2 ); + +EXPLAIN EXTENDED +SELECT * +FROM t1 + INNER JOIN + ( t2 STRAIGHT_JOIN ( SELECT * FROM t3 ) AS sq + ON ( 1 IN ( SELECT f4 FROM t4 ) ) ) + ON ( f1 >= f2 ); + +DROP TABLE t1,t2,t3,t4; + -- cgit v1.2.1