diff options
author | Igor Babaev <igor@askmonty.org> | 2011-07-29 17:09:16 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-07-29 17:09:16 -0700 |
commit | 103c4461ca5dfa85516652afd195c75ab69b1db7 (patch) | |
tree | 75c138e6c2698c4dc8fc48809e812c7944f6e6b6 /mysql-test/t/join_nested.test | |
parent | cfa08e8dadefc00e9542953a4a672b3a34f34303 (diff) | |
download | mariadb-git-103c4461ca5dfa85516652afd195c75ab69b1db7.tar.gz |
Fixed LP bug #817360.
This problem could be observed for queries with nested outer joins
for which the not_exist optimization were applicable.
The problem was caused by the code of the patch for bug #49322
that erroneously forced the return to the previous nested loop
level when the join algorithm successfully builds a partial record
for an embedded outer to which the not_exist optimization could be
applied.
Actually the immediate return to the previous nested loops level
is correct only if this partial record is rejected by a predicate
pushed down to one of the inner tables of this outer join. Otherwise
attempts to find extensions of this record must be made.
Diffstat (limited to 'mysql-test/t/join_nested.test')
-rw-r--r-- | mysql-test/t/join_nested.test | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/join_nested.test b/mysql-test/t/join_nested.test index e36d861f8bb..deda56eb8ee 100644 --- a/mysql-test/t/join_nested.test +++ b/mysql-test/t/join_nested.test @@ -1236,5 +1236,35 @@ SELECT t1.pk, t1.a, t2.pk, t2.a,t3.pk, t3.a DROP TABLE t1, t2, t3; +# +# LP BUG#817360: Nested left joins + not-exist optimization +# + +CREATE TABLE t1 (a int NOT NULL ); +INSERT INTO t1 VALUES (9), (9); + +CREATE TABLE t2 (a int NOT NULL ); +INSERT INTO t2 VALUES (9); + +CREATE TABLE t3 (a int NOT NULL, b int); +INSERT INTO t3 VALUES (19,9); + +CREATE TABLE t4 (b int) ; + +SELECT * FROM t1 LEFT JOIN + ((t2 LEFT JOIN t3 ON t2.a=t3.b) LEFT JOIN t4 ON t3.a=t4.b) + ON t1.a=t2.a; +SELECT * FROM t1 LEFT JOIN + ((t2 LEFT JOIN t3 ON t2.a=t3.b) LEFT JOIN t4 ON t3.a=t4.b) + ON t1.a=t2.a + WHERE t3.a IS NULL; +EXPLAIN EXTENDED +SELECT * FROM t1 LEFT JOIN + ((t2 LEFT JOIN t3 ON t2.a=t3.b) LEFT JOIN t4 ON t3.a=t4.b) + ON t1.a=t2.a + WHERE t3.a IS NULL; + +DROP TABLE t1,t2,t3,t4; + --echo End of 5.0 tests |