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.
@ -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)