summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/roles/rename_user.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/roles/rename_user.test')
-rw-r--r--mysql-test/suite/roles/rename_user.test48
1 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/suite/roles/rename_user.test b/mysql-test/suite/roles/rename_user.test
new file mode 100644
index 00000000..8c899352
--- /dev/null
+++ b/mysql-test/suite/roles/rename_user.test
@@ -0,0 +1,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;
+