mariadb/mysql-test/suite/roles/grant_revoke_current.test
Oleksandr Byelkin 0253ea7f22 MDEV-19650: Privilege bug on MariaDB 10.4
Also fixes:
MDEV-21487: Implement option for mysql_upgrade that allows root@localhost to be replaced
MDEV-21486: Implement option for mysql_install_db that allows root@localhost to be replaced

Add user mariadb.sys to be definer of user view
(and has right on underlying table global_priv for
required operation over global_priv
(SELECT,UPDATE,DELETE))

Also changed definer of gis functions in case of creation,
but they work with any definer so upgrade script do not try
to push this change.
2020-05-07 10:54:56 +02:00

32 lines
895 B
Text

--source include/not_embedded.inc
select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
--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;
set password=password('foobar');
show grants;
grant r1 to current_user() identified by 'barfoo';
show grants;
set password='';
#cleanup
drop role r1;
update mysql.global_priv set priv=@root_priv where user='root' and host='localhost';