summaryrefslogtreecommitdiff
path: root/mysql-test/t/query_cache.test
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2006-11-14 19:50:44 +0300
committerunknown <evgen@moonbone.local>2006-11-14 19:50:44 +0300
commit1019dd404c273b722daa4039d42b1a920439e6b1 (patch)
treed10a53e376fd473c3ab10173af53e5dab66d8e5c /mysql-test/t/query_cache.test
parent405dcd2df29e4693a0981c186d0c55b2f9a37b84 (diff)
downloadmariadb-git-1019dd404c273b722daa4039d42b1a920439e6b1.tar.gz
Bug#20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view
The regression is caused by the fix for bug 14767. When INSERT ... SELECT used a view in the SELECT list that was not inlined, and there was an active transaction, the server could crash in Query_cache::invalidate. On INSERT ... SELECT only the table being inserted into is invalidated. Thus views that can't be inlined are skipped from invalidation. The bug manifests itself in two ways so there is 2 test cases. One checks that the only the table being inserted into is invalidated. And the second one checks that there is no crash on INSERT ... SELECT. mysql-test/t/query_cache.test: Added a test case for bug#20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view mysql-test/r/query_cache.result: Added a test case for bug#20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view sql/sql_parse.cc: Bug#20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view On INSERT ... SELECT only the table being inserted into is invalidated.
Diffstat (limited to 'mysql-test/t/query_cache.test')
-rw-r--r--mysql-test/t/query_cache.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index d416f34ce45..06eb76027b6 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -870,3 +870,32 @@ select * from t1 where a > 3;
show status like 'last_query_cost';
drop table t1;
SET GLOBAL query_cache_size=0;
+
+#
+# Bug #20045: Server crash on INSERT ... SELECT ... FROM non-mergeable view
+#
+set global query_cache_size=1024*1024;
+flush status;
+create table t1 (a int);
+insert into t1 (a) values (1), (2), (3);
+select * from t1;
+show status like 'Qcache_hits';
+select * from t1;
+show status like 'Qcache_hits';
+create table t2 like t1;
+select * from t1;
+show status like 'Qcache_hits';
+insert into t2 select * from t1;
+select * from t1;
+show status like 'Qcache_hits';
+drop table t1, t2;
+
+create table t1(c1 int);
+create table t2(c1 int);
+create table t3(c1 int);
+create view v1 as select t3.c1 as c1 from t3,t2 where t3.c1 = t2.c1;
+start transaction;
+insert into t1(c1) select c1 from v1;
+drop table t1, t2, t3;
+drop view v1;
+set global query_cache_size=0;