diff options
author | unknown <bell@sanja.is.com.ua> | 2005-01-18 21:58:12 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2005-01-18 21:58:12 +0200 |
commit | 957a5cb45e0695be9d5063c1c8be1c8721bc0244 (patch) | |
tree | 1a0db956d03bb50d75e1d2eb7c6aac475058a940 /mysql-test | |
parent | 8bdd5ebc3c6ce40d9c46c2861e8904aa77924cd1 (diff) | |
download | mariadb-git-957a5cb45e0695be9d5063c1c8be1c8721bc0244.tar.gz |
fixed problem in resolving items of outer query in subqueries in view (BUG#6394)
mysql-test/r/view.result:
Resolving view fields in subqueries in VIEW
mysql-test/t/view.test:
Resolving view fields in subqueries in VIEW
sql/table.cc:
emulation of main table list by ancestor list added to view preparation routine to allow subqueries resolve item from outer query corectly
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/view.result | 20 | ||||
-rw-r--r-- | mysql-test/t/view.test | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index c4391781e9c..2e4826c2ee0 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -1724,3 +1724,23 @@ a b 301 0 drop view v3; drop tables t1,t2; +create table t1(c1 int); +create table t2(c2 int); +insert into t1 values (1),(2),(3); +insert into t2 values (1); +SELECT c1 FROM t1 WHERE c1 IN (SELECT c2 FROM t2); +c1 +1 +SELECT c1 FROM t1 WHERE EXISTS (SELECT c2 FROM t2 WHERE c2 = c1); +c1 +1 +create view v1 as SELECT c1 FROM t1 WHERE c1 IN (SELECT c2 FROM t2); +create view v2 as SELECT c1 FROM t1 WHERE EXISTS (SELECT c2 FROM t2 WHERE c2 = c1); +select * from v1; +c1 +1 +select * from v2; +c1 +1 +drop view v2, v1; +drop table t1, t2; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 77f0f65323e..be61431dffa 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1654,3 +1654,19 @@ select * from v3; drop view v3; drop tables t1,t2; + +# +# Resolving view fields in subqueries in VIEW (Bug #6394) +# +create table t1(c1 int); +create table t2(c2 int); +insert into t1 values (1),(2),(3); +insert into t2 values (1); +SELECT c1 FROM t1 WHERE c1 IN (SELECT c2 FROM t2); +SELECT c1 FROM t1 WHERE EXISTS (SELECT c2 FROM t2 WHERE c2 = c1); +create view v1 as SELECT c1 FROM t1 WHERE c1 IN (SELECT c2 FROM t2); +create view v2 as SELECT c1 FROM t1 WHERE EXISTS (SELECT c2 FROM t2 WHERE c2 = c1); +select * from v1; +select * from v2; +drop view v2, v1; +drop table t1, t2; |