mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
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
This commit is contained in:
@ -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."));
|
||||
|
Reference in New Issue
Block a user