Commit 320b8528 authored by Sergei Golubchik's avatar Sergei Golubchik

grant/revoke ... to/from current_role

parent 1f036865
grant select on *.* to current_role;
ERROR 0L000: Invalid definer
revoke select on *.* from current_role;
ERROR 0L000: Invalid definer
revoke all, grant option from current_role;
ERROR 0L000: Invalid definer
create role r1;
grant insert on test.* to r1;
grant r1 to current_user;
set role r1;
select current_role();
current_role()
r1
grant select on *.* to current_role;
show grants for current_role;
Grants for r1
GRANT SELECT ON *.* TO 'r1'
GRANT INSERT ON `test`.* TO 'r1'
revoke insert on test.* from current_role;
show grants for current_role;
Grants for r1
GRANT SELECT ON *.* TO 'r1'
revoke all, grant option from current_role;
show grants for current_role;
Grants for r1
GRANT USAGE ON *.* TO 'r1'
drop role r1;
--source include/not_embedded.inc
--error ER_MALFORMED_DEFINER
grant select on *.* to current_role;
--error ER_MALFORMED_DEFINER
revoke select on *.* from current_role;
--error ER_MALFORMED_DEFINER
revoke all, grant option from current_role;
create role r1;
grant insert on test.* to r1;
grant r1 to current_user;
set role r1;
select current_role();
grant select on *.* to current_role;
show grants for current_role;
revoke insert on test.* from current_role;
show grants for current_role;
revoke all, grant option from current_role;
show grants for current_role;
drop role r1;
......@@ -14356,9 +14356,11 @@ role_list:
current_role:
CURRENT_ROLE optional_braces
{
if (!($$=(LEX_USER*) thd->alloc(sizeof(LEX_USER))))
if (!($$=(LEX_USER*) thd->calloc(sizeof(LEX_USER))))
MYSQL_YYABORT;
$$->user= current_role;
$$->plugin= empty_lex_str;
$$->auth= empty_lex_str;
}
;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment