From 3a5a0ea3928d24a8cd0a45691de6d917672d63c6 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 21 Aug 2007 13:43:09 +0200 Subject: 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 --- mysql-test/t/query_cache.test | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mysql-test/t/query_cache.test') 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'; -- cgit v1.2.1