summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index ab18a2d1d04..de132d169f2 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -3905,11 +3905,15 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
continue; // ok
if (!(~table->grant.privilege & want_access) ||
- table->is_anonymous_derived_table() || table->schema_table)
+ (table->is_anonymous_derived_table() &&
+ table->is_non_materialized_derived_table()) || table->schema_table)
{
/*
It is subquery in the FROM clause. VIEW set table->derived after
- table opening, but this function always called before table opening.
+ table opening, but this function is mostly called before table opening.
+ When it's called after table opening e.g. for nested views with
+ materialization we shoud check the materialized table for access as
+ any other table.
*/
if (!table->referencing_view)
{
@@ -3922,6 +3926,7 @@ bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
}
continue;
}
+
if (!(grant_table= table_hash_search(sctx->host, sctx->ip,
table->get_db_name(), sctx->priv_user,
table->get_table_name(), FALSE)))