diff options
author | Igor Babaev <igor@askmonty.org> | 2011-10-19 23:28:37 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-10-19 23:28:37 -0700 |
commit | 945f12cf8fc361844f3553599795beb549fc8c1d (patch) | |
tree | 3909d7a45593f23f0c82c224e94a16d66d124899 /mysql-test/t/derived_view.test | |
parent | 4720b6f68bfcec7b6fc4c3772ae61bbbc629ca5d (diff) | |
download | mariadb-git-945f12cf8fc361844f3553599795beb549fc8c1d.tar.gz |
Fixed LP bug #877316.
This bug happened due to incompleteness of the fix for bug 872735:
the occurrences of the fields in the conditions of correlated
subqueries were not taken into account when recalculating
covering keys bit maps.
Diffstat (limited to 'mysql-test/t/derived_view.test')
-rw-r--r-- | mysql-test/t/derived_view.test | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index 044f6a1704f..d3ddc17de3c 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -946,6 +946,32 @@ SELECT * FROM t3 DROP VIEW v1; DROP TABLE t1,t2,t3; +--echo # +--echo # LP bug #877316: query over a view with correlated subquery in WHERE +--echo # + +CREATE TABLE t1 (a int, b int, PRIMARY KEY (a)) ; +INSERT INTO t1 VALUES (18,2), (19,9); + +CREATE TABLE t2 (a int, b int) ; +INSERT INTO t2 VALUES (10,8), (5,10); + +CREATE VIEW v1 AS SELECT * FROM t1; + +SELECT t1.a FROM t1 + WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < t1.b); +EXPLAIN +SELECT t1.a FROM t1 + WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < t1.b); + +SELECT v1.a FROM v1 + WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < v1.b); +EXPLAIN +SELECT v1.a FROM v1 + WHERE EXISTS (SELECT t2.a FROM t2 WHERE t2.b < v1.b); + +DROP VIEW v1; +DROP TABLE t1,t2; # The following command must be the last one the file set optimizer_switch=@exit_optimizer_switch; |