summaryrefslogtreecommitdiff
path: root/sql/sql_cache.cc
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 /sql/sql_cache.cc
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 'sql/sql_cache.cc')
-rw-r--r--sql/sql_cache.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 4a5bb263a5f..cc5b4276c82 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -3007,8 +3007,19 @@ Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used,
The grant.want_privileges flag was set to 1 in the
check_grant() function earlier if the TABLE_LIST object
had any associated column privileges.
+
+ We need to check that the TABLE_LIST object isn't part
+ of a VIEW definition because we want to be able to cache
+ views.
+
+ TODO: Although it is possible to cache views, the privilege
+ check on view tables always fall back on column privileges
+ even if there are more generic table privileges. Thus it isn't
+ currently possible to retrieve cached view-tables unless the
+ client has the super user privileges.
*/
- if (tables_used->grant.want_privilege)
+ if (tables_used->grant.want_privilege &&
+ tables_used->belong_to_view == NULL)
{
DBUG_PRINT("qcache", ("Don't cache statement as it refers to "
"tables with column privileges."));