1 drop table if exists t1,t2,v1,v2,v3;
2 drop view if exists t1,t2,v1,v2,v3;
3 set GLOBAL query_cache_size=1355776;
5 create table t1 (a int, b int);
6 create view v1 (c,d) as select sql_no_cache a,b from t1;
7 create view v2 (c,d) as select a+rand(),b from t1;
8 show status like "Qcache_queries_in_cache";
10 Qcache_queries_in_cache 0
11 show status like "Qcache_inserts";
14 show status like "Qcache_hits";
21 show status like "Qcache_queries_in_cache";
23 Qcache_queries_in_cache 0
24 show status like "Qcache_inserts";
27 show status like "Qcache_hits";
34 show status like "Qcache_queries_in_cache";
36 Qcache_queries_in_cache 0
37 show status like "Qcache_inserts";
40 show status like "Qcache_hits";
44 set query_cache_type=demand;
46 create view v1 (c,d) as select sql_cache a,b from t1;
47 show status like "Qcache_queries_in_cache";
49 Qcache_queries_in_cache 0
50 show status like "Qcache_inserts";
53 show status like "Qcache_hits";
58 show status like "Qcache_queries_in_cache";
60 Qcache_queries_in_cache 1
61 show status like "Qcache_inserts";
64 show status like "Qcache_hits";
69 show status like "Qcache_queries_in_cache";
71 Qcache_queries_in_cache 1
72 show status like "Qcache_inserts";
75 show status like "Qcache_hits";
80 show status like "Qcache_queries_in_cache";
82 Qcache_queries_in_cache 1
83 show status like "Qcache_inserts";
86 show status like "Qcache_hits";
91 show status like "Qcache_queries_in_cache";
93 Qcache_queries_in_cache 1
94 show status like "Qcache_inserts";
97 show status like "Qcache_hits";
101 set query_cache_type=default;
103 create table t1 (a int);
104 insert into t1 values (1), (2), (3);
105 create view v1 as select a from t1 where a > 1;
110 alter view v1 as select a from t1 where a > 2;
116 ERROR 42S02: Table 'test.v1' doesn't exist
118 create table t1 (a int, primary key (a), b int);
119 create table t2 (a int, primary key (a), b int);
120 insert into t2 values (1000, 2000);
121 create view v3 (a,b) as select t1.a as a, t2.a as b from t1, t2;
126 create table t1(f1 int);
127 insert into t1 values(1),(2),(3);
128 create view v1 as select * from t1;
129 set query_cache_wlock_invalidate=1;
130 lock tables v1 read /*!32311 local */;
132 set query_cache_wlock_invalidate=default;
136 create table t1 (a int, b int);
137 create algorithm=temptable view v1 as select * from t1;
140 show status like "Qcache_queries_in_cache";
142 Qcache_queries_in_cache 1
143 show status like "Qcache_inserts";
146 show status like "Qcache_hits";
151 show status like "Qcache_queries_in_cache";
153 Qcache_queries_in_cache 1
154 show status like "Qcache_inserts";
157 show status like "Qcache_hits";
160 insert into t1 values (1,1);
161 show status like "Qcache_queries_in_cache";
163 Qcache_queries_in_cache 0
164 show status like "Qcache_inserts";
167 show status like "Qcache_hits";
176 show status like "Qcache_queries_in_cache";
178 Qcache_queries_in_cache 1
179 show status like "Qcache_inserts";
182 show status like "Qcache_hits";
186 show status like "Qcache_queries_in_cache";
188 Qcache_queries_in_cache 0
189 show status like "Qcache_inserts";
192 show status like "Qcache_hits";
197 # Bug46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table
199 CREATE TABLE t1 (c1 INT, c2 INT);
200 CREATE TABLE t2 LIKE t1;
202 CREATE VIEW t1_view AS SELECT c1 FROM t1 NATURAL JOIN t2 ;
203 INSERT INTO t1_view (c1, c2) SELECT c1, c2 FROM t1;
204 ERROR 42S22: Unknown column 'c2' in 'field list'
208 SET AUTOCOMMIT=DEFAULT;
209 set GLOBAL query_cache_size=default;