summaryrefslogtreecommitdiff
path: root/mysql-test/t/query_cache.test
diff options
context:
space:
mode:
authorunknown <thek@adventure.(none)>2007-08-21 13:43:09 +0200
committerunknown <thek@adventure.(none)>2007-08-21 13:43:09 +0200
commit3a5a0ea3928d24a8cd0a45691de6d917672d63c6 (patch)
tree2705f9014c7fbbaf9825368184180cb21c12d8e5 /mysql-test/t/query_cache.test
parentbd80048fdbcd828622858520ff69707056da6595 (diff)
downloadmariadb-git-3a5a0ea3928d24a8cd0a45691de6d917672d63c6.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. Views are excepted and can be cached but only retrieved by super user account. mysql-test/t/query_cache_with_views.test: Rename: mysql-test/t/view_query_cache.test -> mysql-test/t/query_cache_with_views.test mysql-test/r/query_cache_with_views.result: Rename: mysql-test/r/view_query_cache.result -> mysql-test/r/query_cache_with_views.result mysql-test/r/query_cache.result: Modified test case to allow caching of views mysql-test/t/query_cache.test: Modified test case to allow caching of views sql/sql_cache.cc: Allow caching of views
Diffstat (limited to 'mysql-test/t/query_cache.test')
-rw-r--r--mysql-test/t/query_cache.test5
1 files changed, 4 insertions, 1 deletions
diff --git a/mysql-test/t/query_cache.test b/mysql-test/t/query_cache.test
index 7f4d4227f41..9d2e05fb874 100644
--- a/mysql-test/t/query_cache.test
+++ b/mysql-test/t/query_cache.test
@@ -1103,10 +1103,11 @@ disconnect user3;
--disable_warnings
DROP DATABASE IF EXISTS bug30269;
--enable_warnings
+FLUSH STATUS;
CREATE DATABASE bug30269;
USE bug30269;
CREATE TABLE test1 (id int, name varchar(23));
-CREATE VIEW view1 AS SELECT id FROM test1;
+CREATE VIEW view1 AS SELECT * 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';
@@ -1115,7 +1116,9 @@ connect (bug30269, localhost, bug30269,,);
connection bug30269;
USE bug30269;
show status like 'Qcache_queries_in_cache';
+--echo # Select statement not stored in query cache because of column privileges.
SELECT id FROM test1 WHERE id>2;
+show status like 'Qcache_queries_in_cache';
SELECT id FROM view1 WHERE id>2;
show status like 'Qcache_queries_in_cache';