summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorthek@adventure.(none) <>2007-08-17 16:55:20 +0200
committerthek@adventure.(none) <>2007-08-17 16:55:20 +0200
commita4248c2dd370fd7c64b4fa48085f55fd4fe41272 (patch)
treebd6aa41892045dd6b60e4f78c7d3215fb8d20bbb /mysql-test
parent889b4ebcee0cbbc01cc1d87d04a9c2524dc49408 (diff)
downloadmariadb-git-a4248c2dd370fd7c64b4fa48085f55fd4fe41272.tar.gz
Bug #30269 Query cache eats memory
Although the query cache doesn't support retrieval of statements containing column level access control, it was still possible to cache such statements thus wasting memory. This patch extends the access control check on the target tables to avoid caching a statement with column level restrictions.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/query_cache.result24
-rw-r--r--mysql-test/t/query_cache.test30
2 files changed, 53 insertions, 1 deletions
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index f1f99012910..ecf7df2d2ae 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -1502,6 +1502,30 @@ a (select count(*) from t2)
3 0
4 0
drop table t1,t2;
+DROP DATABASE IF EXISTS bug30269;
+CREATE DATABASE bug30269;
+USE bug30269;
+CREATE TABLE test1 (id int, name varchar(23));
+CREATE VIEW view1 AS SELECT id FROM test1;
+INSERT INTO test1 VALUES (5, 'testit');
+GRANT SELECT (id) ON TABLE bug30269.test1 TO 'bug30269'@'localhost';
+GRANT SELECT ON TABLE bug30269.view1 TO 'bug30269'@'localhost';
+set global query_cache_size= 81920;
+USE bug30269;
+show status like 'Qcache_queries_in_cache';
+Variable_name Value
+Qcache_queries_in_cache 0
+SELECT id FROM test1 WHERE id>2;
+id
+5
+SELECT id FROM view1 WHERE id>2;
+id
+5
+show status like 'Qcache_queries_in_cache';
+Variable_name Value
+Qcache_queries_in_cache 0
+DROP DATABASE bug30269;
+DROP USER 'bug30269'@'localhost';
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 962f53936a3..7f4d4227f41 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -1096,9 +1096,37 @@ connection default;
disconnect user1;
disconnect user2;
disconnect user3;
+
+#
+# Bug #30269 Query cache eats memory
+#
+--disable_warnings
+DROP DATABASE IF EXISTS bug30269;
+--enable_warnings
+CREATE DATABASE bug30269;
+USE bug30269;
+CREATE TABLE test1 (id int, name varchar(23));
+CREATE VIEW view1 AS SELECT id FROM test1;
+INSERT INTO test1 VALUES (5, 'testit');
+GRANT SELECT (id) ON TABLE bug30269.test1 TO 'bug30269'@'localhost';
+GRANT SELECT ON TABLE bug30269.view1 TO 'bug30269'@'localhost';
+set global query_cache_size= 81920;
+connect (bug30269, localhost, bug30269,,);
+connection bug30269;
+USE bug30269;
+show status like 'Qcache_queries_in_cache';
+SELECT id FROM test1 WHERE id>2;
+SELECT id FROM view1 WHERE id>2;
+show status like 'Qcache_queries_in_cache';
+
+connection default;
+DROP DATABASE bug30269;
+disconnect bug30269;
+DROP USER 'bug30269'@'localhost';
+
set GLOBAL query_cache_type=default;
set GLOBAL query_cache_limit=default;
set GLOBAL query_cache_min_res_unit=default;
set GLOBAL query_cache_size=default;
-# End of 5.0 tests
+# End of 5.0 tests