diff options
author | unknown <sanja@askmonty.org> | 2011-11-24 15:12:10 +0200 |
---|---|---|
committer | unknown <sanja@askmonty.org> | 2011-11-24 15:12:10 +0200 |
commit | 6fbf8f1926851ecc377b70ad1313b1d213d51010 (patch) | |
tree | c41d04bc6c2af2374d3a7e5729921fa4694a5af5 /mysql-test/t/subselect.test | |
parent | 7b08d996277a5019f1e357f595ba78a3455841cc (diff) | |
download | mariadb-git-6fbf8f1926851ecc377b70ad1313b1d213d51010.tar.gz |
Fix for LP BUG#859375 and LP BUG#887458.
Stop attempts to apply IN/ALL/ANY optimizations to so called "fake_select"
(used for ordering and filtering results of union) in union subquery execution.
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r-- | mysql-test/t/subselect.test | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index e8a778232bc..a39b7ea49b8 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -4778,4 +4778,60 @@ set @@optimizer_switch='in_to_exists=on,semijoin=off,materialization=off,subquer select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1 where a in (select a from t1))))))))))))))))))))))))))))); drop table t1; +--echo # +--echo # LP bug #859375: Assertion `0' failed in st_select_lex_unit::optimize +--echo # with view , UNION and prepared statement (rewriting fake_select +--echo # condition). +--echo # + +CREATE TABLE t1 ( f1 int NOT NULL, f4 varchar(1) NOT NULL) ; +INSERT INTO t1 VALUES (6,'d'),(7,'y'); + +CREATE TABLE t2 ( f1 int NOT NULL, f2 int NOT NULL) ; +INSERT INTO t2 VALUES (10,7); + +CREATE VIEW v2 AS SELECT * FROM t2; + +PREPARE st1 FROM " + SELECT * + FROM t1 + LEFT JOIN v2 ON ( v2.f2 = t1.f1 ) + WHERE v2.f1 NOT IN ( + SELECT 1 UNION + SELECT 247 + ) +"; + +EXECUTE st1; +deallocate prepare st1; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # LP bug #887458 Crash in subselect_union_engine::no_rows with +--echo # double UNION and join_cache_level=3,8 +--echo # (IN/ALL/ANY optimizations should not be applied to fake_select) + +CREATE TABLE t2 ( a int, b varchar(1)) ; +INSERT IGNORE INTO t2 VALUES (8,'y'),(8,'y'); + +CREATE TABLE t1 ( b varchar(1)) ; +INSERT IGNORE INTO t1 VALUES (NULL),(NULL); + +set @save_join_cache_level=@@join_cache_level; +SET SESSION join_cache_level=3; + +SELECT * +FROM t1, t2 +WHERE t2.b IN ( + SELECT 'm' UNION + SELECT 'm' +) OR t1.b <> SOME ( + SELECT 'v' UNION + SELECT 't' +); + +set @@join_cache_level= @save_join_cache_level; +drop table t1,t2; set optimizer_switch=@subselect_tmp; |