summaryrefslogtreecommitdiff
path: root/mysql-test/t/table_elim.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/table_elim.test')
-rw-r--r--mysql-test/t/table_elim.test32
1 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/t/table_elim.test b/mysql-test/t/table_elim.test
index 7ad69d5bf37..5576362b396 100644
--- a/mysql-test/t/table_elim.test
+++ b/mysql-test/t/table_elim.test
@@ -467,3 +467,35 @@ HAVING
field4 != 6;
drop table t0,t1,t2,t3,t4,t5,t6;
+
+--echo #
+--echo # BUG#675118: Elimination of a table results in an invalid execution plan
+--echo #
+CREATE TABLE t1 (f1 int(11), PRIMARY KEY (f1)) ;
+
+CREATE TABLE t2 (f4 varchar(1024), KEY (f4)) ;
+INSERT IGNORE INTO t2 VALUES ('xcddwntkbxyorzdv'),
+ ('cnxxcddwntkbxyor'),('r'),('r'), ('did'),('I'),('when'),
+ ('hczkfqjeggivdvac'),('e'),('okay'),('up');
+
+CREATE TABLE t3 (f4 varchar(1024), f1 int(11), f2 int(11)) ;
+INSERT IGNORE INTO t3 VALUES ('f','4','0'),('n','5','-996540416');
+
+CREATE TABLE t4 (f1 int(11), f3 varchar(10)) ;
+INSERT IGNORE INTO t4 VALUES ('8','n'),('9','nwzcerzsgx'),('10','c');
+
+CREATE TABLE t5 (f5 int(11), KEY (f5)) ;
+
+EXPLAIN
+SELECT t3.f2
+FROM t2
+LEFT JOIN t3
+LEFT JOIN t4
+LEFT JOIN t1 ON t4.f1 = t1.f1
+JOIN t5 ON t4.f3 ON t3.f1 = t5.f5 ON t2.f4 = t3.f4
+WHERE t3.f2 ;
+--echo # ^^ The above must not produce a QEP of t3,t5,t2,t4
+--echo # as that violates the "no interleaving of outer join nests" rule.
+
+DROP TABLE t1,t2,t3,t4,t5;
+