mirror of
https://github.com/MariaDB/server.git
synced 2025-10-09 01:09:15 +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.
102 lines
3.4 KiB
Text
102 lines
3.4 KiB
Text
source include/not_embedded.inc;
|
|
source include/have_perfschema.inc;
|
|
|
|
--disable_service_connection
|
|
|
|
#
|
|
# LOCK TABLES and privileges on views
|
|
#
|
|
create database mysqltest1;
|
|
create database mysqltest2;
|
|
create database mysqltest3;
|
|
create user invoker@localhost;
|
|
create user definer@localhost;
|
|
grant select,show view on mysqltest1.* to invoker@localhost;
|
|
grant select,show view on mysqltest1.* to definer@localhost;
|
|
grant select,show view on mysqltest2.* to invoker@localhost;
|
|
grant select,show view on mysqltest2.* to definer@localhost;
|
|
grant select,show view on mysqltest3.* to invoker@localhost;
|
|
grant select on performance_schema.* to definer@localhost;
|
|
create table mysqltest1.t1 (a int);
|
|
create definer=definer@localhost view mysqltest2.v2 as select * from mysqltest1.t1;
|
|
create definer=definer@localhost view mysqltest3.v3 as select * from mysqltest2.v2;
|
|
create definer=definer@localhost view mysqltest3.v3is as select schema_name from information_schema.schemata order by schema_name;
|
|
create definer=definer@localhost view mysqltest3.v3ps as select user from performance_schema.users where current_connections>0 order by user;
|
|
create definer=definer@localhost view mysqltest3.v3nt as select 1;
|
|
create definer=definer@localhost sql security invoker view mysqltest3.v3i as select * from mysqltest1.t1;
|
|
|
|
exec $MYSQL_DUMP --no-autocommit=0 --compact -B mysqltest1 mysqltest2 mysqltest3;
|
|
|
|
connect inv,localhost,invoker;
|
|
error ER_DBACCESS_DENIED_ERROR;
|
|
lock table mysqltest3.v3 write;
|
|
disconnect inv;
|
|
connection default;
|
|
|
|
grant lock tables on mysqltest3.* to invoker@localhost;
|
|
connect inv,localhost,invoker;
|
|
show create view mysqltest3.v3;
|
|
show create view mysqltest3.v3is;
|
|
show create view mysqltest3.v3ps;
|
|
show create view mysqltest3.v3nt;
|
|
show create view mysqltest3.v3i;
|
|
error ER_VIEW_INVALID;
|
|
lock table mysqltest3.v3 write;
|
|
error ER_VIEW_INVALID;
|
|
lock table mysqltest3.v3i write;
|
|
lock table mysqltest3.v3is write; select * from mysqltest3.v3is;
|
|
lock table mysqltest3.v3ps write; select * from mysqltest3.v3ps;
|
|
lock table mysqltest3.v3nt write; select * from mysqltest3.v3nt;
|
|
disconnect inv;
|
|
connection default;
|
|
|
|
grant lock tables on mysqltest2.* to invoker@localhost;
|
|
connect inv,localhost,invoker;
|
|
error ER_VIEW_INVALID;
|
|
lock table mysqltest3.v3 write;
|
|
error ER_VIEW_INVALID;
|
|
lock table mysqltest3.v3i write;
|
|
disconnect inv;
|
|
connection default;
|
|
|
|
grant lock tables on mysqltest1.* to definer@localhost;
|
|
connect inv,localhost,invoker;
|
|
lock table mysqltest3.v3 write; select * from mysqltest3.v3;
|
|
error ER_VIEW_INVALID;
|
|
lock table mysqltest3.v3i write;
|
|
disconnect inv;
|
|
connection default;
|
|
|
|
grant lock tables on mysqltest1.* to invoker@localhost;
|
|
connect inv,localhost,invoker;
|
|
lock table mysqltest3.v3i write; select * from mysqltest3.v3i;
|
|
disconnect inv;
|
|
connection default;
|
|
|
|
--disable_warnings
|
|
drop user invoker@localhost;
|
|
drop user definer@localhost;
|
|
--enable_warnings
|
|
drop database mysqltest1;
|
|
drop database mysqltest2;
|
|
drop database mysqltest3;
|
|
|
|
--echo #
|
|
--echo # MDEV-24331 mysqldump fails with "Got error: 1356" if the database contains a view with a subquery
|
|
--echo #
|
|
create user u1@localhost;
|
|
grant all privileges on test.* to u1@localhost;
|
|
connect con1,localhost,u1;
|
|
use test;
|
|
create table t1 (id int not null);
|
|
create view v1 as select * from (select * from t1) dt;
|
|
lock table v1 read;
|
|
disconnect con1;
|
|
connection default;
|
|
exec $MYSQL_DUMP --no-autocommit=0 test v1 -uu1 --compact;
|
|
drop view v1;
|
|
drop table t1;
|
|
--disable_warnings
|
|
drop user u1@localhost;
|
|
--enable_warnings
|
|
--enable_service_connection
|