mariadb/mysql-test/suite/roles/create_and_drop_current.result
Dmitry Shulga ae5b1acc55 MDEV-35617: DROP USER should leave no active session for that user
On handling the DROP USER statement it is counted a number of sessions
established on behalf every user being dropped. In case the DROP USER
statement is executed in sql_mode = oracle the error
  ER_CANNOT_USER
if there are active connections for any of the users listed at
the DROP USER statement. For sql_mode != oracle the warning
  ER_ACTIVE_CONNECTIONS_FOR_USER_TO_DROP
if there are active connections.

Every user being dropped is marked with flag that disallow establishing
a new connections on behalf this user.
2025-06-12 18:43:59 +02:00

36 lines
1.7 KiB
Text

create user foo@localhost;
grant create user on *.* to foo@localhost;
create user current_user;
ERROR HY000: Operation CREATE USER failed for CURRENT_USER
create user current_role;
ERROR HY000: Operation CREATE USER failed for CURRENT_ROLE
create role current_user;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'current_user' at line 1
create role current_role;
ERROR HY000: Operation CREATE ROLE failed for CURRENT_ROLE
drop user current_user;
Warnings:
Note 4240 Dropped users 'foo'@'localhost' have active connections. Use KILL CONNECTION if they should not be used anymore.
drop user current_role;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'current_role' at line 1
drop role current_user;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'current_user' at line 1
drop role current_role;
ERROR HY000: Operation DROP ROLE failed for CURRENT_ROLE
show warnings;
Level Code Message
Error 1959 Invalid role specification `NONE`
Error 1396 Operation DROP ROLE failed for CURRENT_ROLE
create role r1;
grant r1 to current_user;
set role r1;
select current_role();
current_role()
r1
create user current_role;
ERROR HY000: Operation CREATE USER failed for CURRENT_ROLE
create role current_role;
ERROR HY000: Operation CREATE ROLE failed for CURRENT_ROLE
drop user current_role;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'current_role' at line 1
drop role current_role;