mariadb/mysql-test/suite/roles/rename_user.test
Sergei Golubchik 8ea529ecba MDEV-29131 Assertion `status == 0' failed when renaming user after deleting table roles_mapping
if mysql.roles_mapping table doesn't exist (it's optional, after all),
we still update in-memory structures to keep them consistent
2022-07-29 21:58:38 +02:00

48 lines
1.3 KiB
Text

source include/not_embedded.inc;
#create a user with no privileges
create user test_user@localhost;
create role test_role1;
grant test_role1 to test_user@localhost;
create role test_role2;
grant test_role2 to test_role1;
use mysql;
--sorted_result
select * from roles_mapping;
#regular user rename
rename user 'test_user'@'localhost' to 'test_user_rm'@'newhost';
--sorted_result
select user, host from user where user like 'test%';
--sorted_result
select * from roles_mapping;
######### role rename does not work yet
#rename user 'test_role2'@'' to 'test_role2_rm'@'';
#--sorted_result
#select user, host from user where user like 'test%';
#--sorted_result
#select * from roles_mapping;
#
##role rename
#rename user 'test_role1'@'' to 'test_role1_rm'@'';
#--sorted_result
#select user, host from user where user like 'test%';
#--sorted_result
#select * from roles_mapping;
delete from mysql.roles_mapping;
delete from mysql.user where user like 'test%';
flush privileges;
--echo #
--echo # MDEV-29131 Assertion `status == 0' failed when renaming user after deleting table roles_mapping
--echo #
create role r;
rename table mysql.roles_mapping to test.t1;
rename user current_user to a@a;
rename user a@a to root@localhost;
rename table test.t1 to mysql.roles_mapping;
drop role r;