summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test11
1 files changed, 11 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 6a14c2d573e..f9ff64e2e5b 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -932,3 +932,14 @@ create view v1 as select a, sum(b) from t1 group by a;
select b from v1 use index (some_index) where b=1;
drop view v1;
drop table t1;
+
+#
+# using VIEW fields several times in query resolved via temporary tables
+#
+create table t1 (col1 char(5),col2 char(5));
+create view v1 (col1,col2) as select col1,col2 from t1;
+insert into v1 values('s1','p1'),('s1','p2'),('s1','p3'),('s1','p4'),('s2','p1'),('s3','p2'),('s4','p4');
+select distinct first.col2 from t1 first where first.col2 in (select second.col2 from t1 second where second.col1<>first.col1);
+select distinct first.col2 from v1 first where first.col2 in (select second.col2 from t1 second where second.col1<>first.col1);
+drop view v1;
+drop table t1;