summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect_cache.test
diff options
context:
space:
mode:
authorunknown <sanja@askmonty.org>2011-11-01 17:42:52 +0200
committerunknown <sanja@askmonty.org>2011-11-01 17:42:52 +0200
commitb40bc2b3e3afee92a6d33d80840840fcf9baae11 (patch)
tree6b836e02a31995d2fdf3a71ff04c31f0abccccf4 /mysql-test/t/subselect_cache.test
parent391c5db1fca4b9d36afa3d131b4f5401fa9189f6 (diff)
downloadmariadb-git-b40bc2b3e3afee92a6d33d80840840fcf9baae11.tar.gz
Fix of LP BUG#872775.
The problem was that merged views has its own nest_level numbering => when we compare nest levels we should take into considiration basis (i.e. 0 level), if it is different then nest levels are not comparable.
Diffstat (limited to 'mysql-test/t/subselect_cache.test')
-rw-r--r--mysql-test/t/subselect_cache.test34
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/t/subselect_cache.test b/mysql-test/t/subselect_cache.test
index 3d8de4e4808..6bf5028b6cf 100644
--- a/mysql-test/t/subselect_cache.test
+++ b/mysql-test/t/subselect_cache.test
@@ -1,4 +1,10 @@
+--disable_warnings
+drop table if exists t1,t2,t3,t4,t5;
+drop view if exists v1;
+--enable_warnings
+
+
set optimizer_switch='subquery_cache=on';
create table t1 (a int, b int);
@@ -1664,5 +1670,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;