summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_cache.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/subselect_cache.test')
-rw-r--r--mysql-test/t/subselect_cache.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_cache.test b/mysql-test/t/subselect_cache.test
index e4671cf7b2a..d06bf06756a 100644
--- a/mysql-test/t/subselect_cache.test
+++ b/mysql-test/t/subselect_cache.test
@@ -1,6 +1,8 @@
--disable_warnings
drop table if exists t0,t1,t2,t3,t4,t5,t6,t7,t8,t9;
+drop view if exists v1;
--enable_warnings
+
set optimizer_switch='subquery_cache=on';
create table t1 (a int, b int);
@@ -1666,5 +1668,33 @@ FROM t1
WHERE t2.f1 OR t2.f3 );
drop tables t1, t2, t3;
+--echo #
+--echo # Test of LP BUG#872775 view with "outer references" bug
+--echo #
+set @@optimizer_switch= default;
+set optimizer_switch='subquery_cache=on';
+CREATE TABLE t1 (a int) ;
+
+CREATE TABLE t2 (b int, c varchar(1) NOT NULL ) ;
+INSERT INTO t2 VALUES (1,'x'),(2,'y');
+
+CREATE TABLE t3 (a int) ;
+
+CREATE TABLE t4 ( pk int(11) NOT NULL , b int(11) NOT NULL ) ;
+INSERT INTO t4 VALUES (26,9),(27,5),(28,0),(29,3);
+
+CREATE OR REPLACE VIEW v1 AS
+SELECT t2.b
+FROM t1
+JOIN t2
+WHERE t2 .c > (
+ SELECT t2.c FROM t3
+ );
+
+SELECT * FROM t4 WHERE b NOT IN ( SELECT * FROM v1 );
+
+drop view v1;
+drop table t1,t2,t3,t4;
+
--echo # restore default
set @@optimizer_switch= default;