summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/roles/rename_user.test
blob: 8c8993528479df0bf32f29839882cd140a7228f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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;