diff options
Diffstat (limited to 'sql/sql_cache.cc')
-rw-r--r-- | sql/sql_cache.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 4e5cf157239..98d99f4c6e2 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -3238,8 +3238,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.")); |