diff --git a/mysql-test/suite/perfschema/r/grant.result b/mysql-test/suite/perfschema/r/grant.result new file mode 100644 index 00000000000..4679499279f --- /dev/null +++ b/mysql-test/suite/perfschema/r/grant.result @@ -0,0 +1,7 @@ +create user a@localhost; +connect a,localhost,a; +select * from performance_schema.global_status where variable_name='b'; +VARIABLE_NAME VARIABLE_VALUE +connection default; +disconnect a; +drop user a@localhost; diff --git a/mysql-test/suite/perfschema/t/grant.test b/mysql-test/suite/perfschema/t/grant.test new file mode 100644 index 00000000000..9002357491d --- /dev/null +++ b/mysql-test/suite/perfschema/t/grant.test @@ -0,0 +1,11 @@ +--source include/not_embedded.inc +# +# MDEV-22884 Assertion `grant_table || grant_table_role' failed on perfschema +# +create user a@localhost; +connect a,localhost,a; +select * from performance_schema.global_status where variable_name='b'; +connection default; +disconnect a; +drop user a@localhost; + diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index d8a05686166..c52463fbc91 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -8104,6 +8104,8 @@ bool check_grant(THD *thd, privilege_t want_access, TABLE_LIST *tables, switch(access->check(orig_want_access, &t_ref->grant.privilege)) { case ACL_INTERNAL_ACCESS_GRANTED: + t_ref->grant.privilege|= orig_want_access; + t_ref->grant.want_privilege= NO_ACL; continue; case ACL_INTERNAL_ACCESS_DENIED: goto err;