mirror of
https://github.com/MariaDB/server.git
synced 2025-10-21 23:34:22 +02:00

Follow-up patch with adjustments of test files and updates of result files for tests. Some of tests were rewritten slighlty. Everywhere where common pattern used: ----- CREATE USER userA; --connect con1 ... userA ... <sql statements...> --disconnect con1 DROP USER userA; ----- the DROP USER statement has been eclosed into the directive --disable_warnings --enable_warnings This change is caused by the race conddition between --disconnect and DROP USER since a number of currently running sessions established on behalf the user being dropped is counted by holding the rw_lock THD_list_iterator::lock that is not acquired on execution the DROP USER statement but the lock is taken as the last step on handling disconnection (when the client is already sending the next statement). Therefore, for the cases where the command --disconnect precedes the DROP USER statement we hide the possible warnings about presence of active sessions for the user being deleted to make tests deterministic.
38 lines
1.1 KiB
Text
38 lines
1.1 KiB
Text
create database mysqltest1;
|
|
create database mysqltest2;
|
|
create user foo@localhost;
|
|
create role r1, r2;
|
|
grant all on mysqltest1.* to r1;
|
|
grant all on mysqltest2.* to r2;
|
|
grant r1 to r2;
|
|
grant r2 to foo@localhost;
|
|
connect foo,localhost,foo,,;
|
|
select current_user;
|
|
current_user
|
|
foo@localhost
|
|
show tables in mysqltest1;
|
|
ERROR 42000: Access denied for user 'foo'@'localhost' to database 'mysqltest1'
|
|
show tables in mysqltest2;
|
|
ERROR 42000: Access denied for user 'foo'@'localhost' to database 'mysqltest2'
|
|
set role r2;
|
|
show tables in mysqltest1;
|
|
Tables_in_mysqltest1
|
|
show tables in mysqltest2;
|
|
Tables_in_mysqltest2
|
|
show grants;
|
|
Grants for foo@localhost
|
|
GRANT `r2` TO `foo`@`localhost`
|
|
GRANT USAGE ON *.* TO `foo`@`localhost`
|
|
GRANT `r1` TO `r2`
|
|
GRANT USAGE ON *.* TO `r2`
|
|
GRANT ALL PRIVILEGES ON `mysqltest2`.* TO `r2`
|
|
GRANT USAGE ON *.* TO `r1`
|
|
GRANT ALL PRIVILEGES ON `mysqltest1`.* TO `r1`
|
|
connection default;
|
|
drop user foo@localhost;
|
|
Warnings:
|
|
Note 4226 Dropped users ['foo'@'localhost'] have active connections. Use KILL CONNECTION if they should not be used anymore.
|
|
drop role r1;
|
|
drop role r2;
|
|
drop database mysqltest1;
|
|
drop database mysqltest2;
|