diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2011-11-01 12:36:43 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2011-11-01 12:36:43 +0400 |
commit | f2b6f4e3df2a41e15b155d6019dfa81982181e91 (patch) | |
tree | 4c665d4ef4a14df2401c16c5684304ae27aa3149 /mysql-test/r/table_elim.result | |
parent | aa327cdd484809f2603004a8690bbb2d105deb5e (diff) | |
download | mariadb-git-f2b6f4e3df2a41e15b155d6019dfa81982181e91.tar.gz |
BUG#884184: Wrong result with RIGHT JOIN + derived_merge
- Make eliminate_tables_for_list() take into account that it is not possible
to eliminate a table if it is used in the upper-side ON expressions. Example:
xxx JOIN (t1 LEFT JOIN t2 ON cond ) ON func(t2.columns)
Here it would eliminate t2 which is not possible because of use of t2.columns.
Diffstat (limited to 'mysql-test/r/table_elim.result')
-rw-r--r-- | mysql-test/r/table_elim.result | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/table_elim.result b/mysql-test/r/table_elim.result index 6c713946b27..3200ce392eb 100644 --- a/mysql-test/r/table_elim.result +++ b/mysql-test/r/table_elim.result @@ -566,3 +566,22 @@ id select_type table type possible_keys key key_len ref rows Extra # ^^ The above must not produce a QEP of t3,t5,t2,t4 # as that violates the "no interleaving of outer join nests" rule. DROP TABLE t1,t2,t3,t4,t5; +# +# BUG#884184: Wrong result with RIGHT JOIN + derived_merge +# +CREATE TABLE t1 (a int(11), b varchar(1)) ; +INSERT IGNORE INTO t1 VALUES (0,'g'); +CREATE TABLE t3 ( a varchar(1)) ; +INSERT IGNORE INTO t3 VALUES ('g'); +CREATE TABLE t2 ( a int(11) NOT NULL, PRIMARY KEY (a)) ; +create view v1 as SELECT t1.* FROM t1 LEFT JOIN t2 ON ( t1.a = t2.a ) WHERE t2.a <> 0; +SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b ); +a b +NULL NULL +EXPLAIN SELECT alias1.* FROM t3 LEFT JOIN v1 as alias1 ON ( t3.a = alias1.b ); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t3 system NULL NULL NULL NULL 1 +1 SIMPLE t1 ALL NULL NULL NULL NULL 1 +1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index +drop view v1; +DROP TABLE t1,t2,t3; |