1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

cleanup: disconnect before DROP USER

let's always disconnect a user connection before dropping the said user.
MariaDB is traditionally very tolerant to active connections
of the dropped user, which isn't the case for most other databases.

Let's avoid unintentionally spreading incompatible behavior
and disconnect before drop.

Except in cases when the test specifically tests such a behavior.
This commit is contained in:
Sergei Golubchik
2025-06-12 08:05:32 +02:00
committed by Dmitry Shulga
parent bead24b7f3
commit e3d9369774
127 changed files with 226 additions and 68 deletions

View File

@ -34,12 +34,14 @@ select @@global.read_only;
ON
alter user foo;
ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
disconnect a;
# Grant READ_ONLY ADMIN privilege to the user.
connection default;
grant READ_ONLY ADMIN on *.* to foo;
# We now have READ_ONLY ADMIN privilege. We should be able to run alter user.
connect b, localhost, foo;
alter user foo;
disconnect b;
connection default;
SET GLOBAL read_only = @start_read_only;
#

View File

@ -32,6 +32,7 @@ select @@global.read_only;
--error ER_OPTION_PREVENTS_STATEMENT
alter user foo;
disconnect a;
--echo # Grant READ_ONLY ADMIN privilege to the user.
connection default;
@ -40,6 +41,7 @@ grant READ_ONLY ADMIN on *.* to foo;
--echo # We now have READ_ONLY ADMIN privilege. We should be able to run alter user.
connect (b, localhost, foo);
alter user foo;
disconnect b;
connection default;
SET GLOBAL read_only = @start_read_only;

View File

@ -76,6 +76,7 @@ Warnings:
Note 1976 Can't drop role 'role_1'; it doesn't exist
DROP ROLE role_1;
ERROR HY000: Operation DROP ROLE failed for 'role_1'
disconnect user_a;
DROP USER u1@localhost;
CREATE ROLE r;
GRANT SHOW DATABASES ON *.* TO r;

View File

@ -54,6 +54,7 @@ DROP ROLE IF EXISTS role_1;
--error ER_CANNOT_USER
DROP ROLE role_1;
disconnect user_a;
DROP USER u1@localhost;
# MDEV-17942

View File

@ -44,6 +44,7 @@ ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege
CREATE OR REPLACE ROLE developer;
ERROR 42000: Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
connection default;
disconnect user_a;
SELECT CURRENT_USER;
CURRENT_USER
root@localhost

View File

@ -61,6 +61,7 @@ CREATE OR REPLACE USER u1@localhost;
CREATE OR REPLACE ROLE developer;
connection default;
disconnect user_a;
SELECT CURRENT_USER;
DROP DATABASE db1;
DROP USER mysqltest_1@localhost;

View File

@ -60,6 +60,7 @@ c d
1 30
1 30
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
#

View File

@ -68,6 +68,7 @@ connection user1;
select * from mysqltest.v3;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;

View File

@ -1294,11 +1294,11 @@ connection bug23556;
USE bug23556;
TRUNCATE t1;
connection default;
disconnect bug23556;
USE test;
DROP DATABASE bug23556;
DROP USER bug23556@localhost;
connection default;
disconnect bug23556;
connect con1, localhost, root,,*NO-ONE*;
connection con1;
GRANT PROCESS ON * TO user@localhost;
@ -1777,8 +1777,8 @@ ERROR 42S01: Table 't4' already exists
create table t1 select * from t2;
ERROR 42000: INSERT command denied to user 'mysqltest'@'localhost' for table `mysqltest`.`t1`
connection default;
drop user mysqltest@localhost;
disconnect user1;
drop user mysqltest@localhost;
drop database mysqltest;
use test;
call mtr.add_suppression("Can't open and lock privilege tables");

View File

@ -962,11 +962,11 @@ USE bug23556;
TRUNCATE t1;
connection default;
disconnect bug23556;
USE test;
DROP DATABASE bug23556;
DROP USER bug23556@localhost;
connection default;
disconnect bug23556;
#
@ -1564,8 +1564,8 @@ create table t4 select * from t2;
create table t1 select * from t2;
connection default;
drop user mysqltest@localhost;
disconnect user1;
drop user mysqltest@localhost;
drop database mysqltest;
use test;

View File

@ -16,6 +16,7 @@ GRANT USAGE ON *.* TO `foo`
show grants for foo@'%';
ERROR 42000: Access denied for user 'test'@'%' to database 'mysql'
connection default;
disconnect conn_1;
drop user test, foo;
drop role foo;
CREATE TABLE t1 (a INT);

View File

@ -20,6 +20,7 @@ show grants for foo; # role
--error ER_DBACCESS_DENIED_ERROR
show grants for foo@'%'; # user
--connection default
--disconnect conn_1
drop user test, foo;
drop role foo;

View File

@ -30,6 +30,7 @@ connection con1;
SHOW SLAVE HOSTS;
Server_id Host Port Master_id
connection default;
disconnect con1;
DROP USER user1@localhost;
#
# End of 10.5 tests

View File

@ -39,6 +39,7 @@ connection con1;
SHOW SLAVE HOSTS;
connection default;
disconnect con1;
DROP USER user1@localhost;
--echo #

View File

@ -45,6 +45,7 @@ call mbase.p1();
call mbase.p1();
call mbase.p1();
connection default;
disconnect user1;
use `inf%`;
drop user mysqltest_1@localhost;
drop table t1;
@ -62,7 +63,6 @@ drop function func2;
drop database `inf%`;
drop procedure mbase.p1;
drop database mbase;
disconnect user1;
#
# Bug#18282 INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views
#
@ -245,9 +245,9 @@ testdb_1 v1
show create view testdb_1.v1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table `testdb_1`.`v1`
connection default;
disconnect user1;
drop user mysqltest_1@localhost;
drop database testdb_1;
disconnect user1;
set global sql_mode=default;
#
# MDEV-20549 SQL SECURITY DEFINER does not work for INFORMATION_SCHEMA tables

View File

@ -66,6 +66,7 @@ call mbase.p1();
--enable_result_log
connection default;
disconnect user1;
use `inf%`;
drop user mysqltest_1@localhost;
drop table t1;
@ -80,7 +81,6 @@ drop function func2;
drop database `inf%`;
drop procedure mbase.p1;
drop database mbase;
disconnect user1;
--echo #
--echo # Bug#18282 INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views
@ -237,9 +237,9 @@ where table_name='v1';
show create view testdb_1.v1;
connection default;
disconnect user1;
drop user mysqltest_1@localhost;
drop database testdb_1;
disconnect user1;
set global sql_mode=default;

View File

@ -36,6 +36,8 @@ Id User Host db Command Time State Info Progress
kill user b;
ERROR HY000: Operation KILL USER failed for b@%
connection default;
disconnect a;
disconnect b;
drop user a@'127.0.0.1';
drop user b@'127.0.0.1';
#

View File

@ -48,6 +48,8 @@ show processlist;
--error ER_KILL_DENIED_ERROR
kill user b;
--connection default
--disconnect a
--disconnect b
drop user a@'127.0.0.1';
drop user b@'127.0.0.1';

View File

@ -954,6 +954,7 @@ select * from t2;
log
triggered
triggered
disconnect a;
drop table t1,t2, t3;
drop user foo;
create table t1 (a int, b int);

View File

@ -921,6 +921,7 @@ insert t3 values (2);
update t1 left join t3 on t1.id = t3.id set t1.v1 = 'hello';
select * from t2;
disconnect a;
drop table t1,t2, t3;
drop user foo;

View File

@ -690,6 +690,7 @@ SELECT * FROM t1;
a b
1 root@localhost
connection default;
disconnect unsecure;
DROP DATABASE mysqltest1;
DROP USER untrusted@localhost;
# Bug#32580 mysqlbinlog cannot read binlog event with user variables

View File

@ -371,6 +371,7 @@ INSERT INTO t1 VALUES (1,USER());
SELECT * FROM t1;
connection default;
disconnect unsecure;
DROP DATABASE mysqltest1;
DROP USER untrusted@localhost;

View File

@ -434,6 +434,8 @@ query INSUFFICIENT_PRIVILEGES
1
set optimizer_trace='enabled=off';
connection default;
disconnect con_foo;
disconnect con_bar;
select current_user();
current_user()
root@localhost

View File

@ -192,6 +192,8 @@ set optimizer_trace='enabled=off';
--enable_view_protocol
connection default;
disconnect con_foo;
disconnect con_bar;
select current_user();
select * from db1.v1;
drop user foo@localhost, bar@localhost;

View File

@ -128,10 +128,10 @@ DATA DIRECTORY 'MYSQLTEST_VARDIR/tmp'
Got one of the listed errors
connection default;
# user root (cleanup):
disconnect con1;
DROP DATABASE mysqltest2;
USE test;
DROP USER mysqltest_1@localhost;
disconnect con1;
create table t2 (i int )
ENGINE = MyISAM
partition by range (i)

View File

@ -165,10 +165,10 @@ connection con1;
);
connection default;
-- echo # user root (cleanup):
disconnect con1;
DROP DATABASE mysqltest2;
USE test;
DROP USER mysqltest_1@localhost;
disconnect con1;
#
# Bug #24633 SQL MODE "NO_DIR_IN_CREATE" does not work with partitioned tables

View File

@ -61,5 +61,6 @@ ERROR 42000: Access denied; you need (at least one of) the SLAVE MONITOR privile
DEALLOCATE PREPARE stmt_1;
include/rpl_end.inc
connection default;
disconnect con2;
DROP USER u1;
# End of 10.2 tests

View File

@ -67,6 +67,7 @@ DEALLOCATE PREPARE stmt_1;
--source include/rpl_end.inc
--connection default
--disconnect con2
# Clean up
DROP USER u1;

View File

@ -331,11 +331,11 @@ ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK_NO_ADMIN
select count(*) from t1,(select a from t1 LOCK IN SHARE MODE) as t2;
ERROR HY000: The MariaDB server is running with the --read-only=NO_LOCK_NO_ADMIN option so it cannot execute this statement
commit;
disconnect con1;
SET GLOBAL read_only=0;
select count(*) from t1;
count(*)
4
drop table t1;
drop user user1;
disconnect con1;
# End of 11.8 tests

View File

@ -447,10 +447,10 @@ select count(*) from t1 LOCK IN SHARE MODE;
select count(*) from t1,(select a from t1 LOCK IN SHARE MODE) as t2;
commit;
disconnect con1;
SET GLOBAL read_only=0;
select count(*) from t1;
drop table t1;
drop user user1;
disconnect con1;
--echo # End of 11.8 tests

View File

@ -19,11 +19,11 @@ a
11733
COMMIT;
ERROR HY000: The MariaDB server is running with the --read-only=ON option so it cannot execute this statement
disconnect con1;
connection default;
set global read_only=0;
drop table table_11733 ;
drop user test@localhost;
disconnect con1;
create user test@localhost;
GRANT CREATE, SELECT, DROP, LOCK TABLES ON *.* TO test@localhost;
connect con1, localhost, test, , test;
@ -64,12 +64,12 @@ connection default;
set global read_only=1;
connection con1;
unlock tables;
disconnect con1;
connection default;
SET GLOBAL read_only=0;
UNLOCK TABLES;
DROP TABLE t1;
DROP USER test@localhost;
disconnect con1;
# End of 5.1 tests
#
# Bug#33669: Transactional temporary tables do not work under --read-only

View File

@ -38,12 +38,12 @@ select * from table_11733 ;
--error ER_OPTION_PREVENTS_STATEMENT
COMMIT;
disconnect con1;
connection default;
set global read_only=0;
drop table table_11733 ;
drop user test@localhost;
disconnect con1;
#
# Bug #35732: read-only blocks SELECT statements in InnoDB
#
@ -93,6 +93,7 @@ set global read_only=1;
connection con1;
unlock tables;
disconnect con1;
connection default;
SET GLOBAL read_only=0;
@ -100,7 +101,6 @@ UNLOCK TABLES;
DROP TABLE t1;
DROP USER test@localhost;
disconnect con1;
--echo # End of 5.1 tests
--echo #

View File

@ -50,6 +50,7 @@ USER() SESSION_USER()
test_user@localhost test_user@localhost
# Cleanup
connection default;
disconnect test_user_con;
DROP USER 'test_user'@'%';
DROP FUNCTION test.func_session_user;
DROP VIEW test.view_session_user;

View File

@ -48,6 +48,7 @@ SELECT USER(), SESSION_USER();
--echo # Cleanup
--connection default
--disconnect test_user_con
DROP USER 'test_user'@'%';
DROP FUNCTION test.func_session_user;
DROP VIEW test.view_session_user;

View File

@ -1046,8 +1046,8 @@ a
1
2
SET debug_dbug=@old_debug;
drop user test2@localhost;
disconnect con2;
drop user test2@localhost;
#
# Test that it is possible to KILL a SHOW EXPLAIN command that's waiting
# on its target thread

View File

@ -933,9 +933,9 @@ connection con1;
reap;
SET debug_dbug=@old_debug;
disconnect con2;
drop user test2@localhost;
disconnect con2;
--echo #
--echo # Test that it is possible to KILL a SHOW EXPLAIN command that's waiting
--echo # on its target thread

View File

@ -459,11 +459,11 @@ SHOW CREATE FUNCTION wl2897_f3;
Function sql_mode Create Function character_set_client collation_connection Database Collation
wl2897_f3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`a @ b @ c`@`localhost` FUNCTION `wl2897_f3`() RETURNS int(11)
RETURN 3 latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
disconnect mysqltest_1_con;
disconnect mysqltest_2_con;
DROP USER mysqltest_1@localhost;
DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest;
disconnect mysqltest_1_con;
disconnect mysqltest_2_con;
connection con1root;
DROP DATABASE IF EXISTS mysqltest;
CREATE DATABASE mysqltest;

View File

@ -644,15 +644,13 @@ SHOW CREATE FUNCTION wl2897_f3;
# Cleanup.
--disconnect mysqltest_1_con
--disconnect mysqltest_2_con
DROP USER mysqltest_1@localhost;
DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest;
--disconnect mysqltest_1_con
--disconnect mysqltest_2_con
#
# Bug#13198 SP executes if definer does not exist
#

View File

@ -168,6 +168,8 @@ def mysqltest_db1 trg3 UPDATE def mysqltest_db1 t1 1 NULL SET @a = 3 ROW BEFORE
def mysqltest_db1 trg4 UPDATE def mysqltest_db1 t1 1 NULL SET @a = 4 ROW AFTER NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @hostname latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
def mysqltest_db1 trg5 DELETE def mysqltest_db1 t1 1 NULL SET @a = 5 ROW BEFORE NULL NULL OLD NEW # STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION @abcdef@@@hostname latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci
connection default;
disconnect wl2818_definer_con;
disconnect wl2818_invoker_con;
DROP USER mysqltest_dfn@localhost;
DROP USER mysqltest_inv@localhost;
DROP DATABASE mysqltest_db1;
@ -343,6 +345,7 @@ DELETE FROM t1;
SELECT @mysqltest_var;
@mysqltest_var
Hello, world!
disconnect bug15166_u1_con;
DROP USER mysqltest_u1@localhost;
DROP DATABASE mysqltest_db1;
DELETE FROM mysql.user WHERE User LIKE 'mysqltest_%';
@ -559,10 +562,10 @@ connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2;
ERROR 42000: TRIGGER command denied to user 'mysqltest_u1'@'localhost' for table `mysqltest_db1`.`t1`
DROP DATABASE mysqltest_db1;
DROP USER mysqltest_u1@localhost;
disconnect con1;
connection default;
DROP DATABASE mysqltest_db1;
DROP USER mysqltest_u1@localhost;
USE test;
# End of 5.1 tests.
#

View File

@ -345,6 +345,8 @@ SELECT * FROM INFORMATION_SCHEMA.TRIGGERS ORDER BY trigger_name;
#
--connection default
--disconnect wl2818_definer_con
--disconnect wl2818_invoker_con
DROP USER mysqltest_dfn@localhost;
DROP USER mysqltest_inv@localhost;
@ -634,6 +636,7 @@ SELECT @mysqltest_var;
# Cleanup.
#
--disconnect bug15166_u1_con
DROP USER mysqltest_u1@localhost;
DROP DATABASE mysqltest_db1;
@ -967,11 +970,11 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_u1@localhost;
--error ER_TABLEACCESS_DENIED_ERROR
UPDATE IGNORE t1, t2 SET t1.a1 = 2, t2.a1 = 3 WHERE t1.a1 = 1 AND t2.a1 = 2;
# Cleanup
--disconnect con1
--connection default
DROP DATABASE mysqltest_db1;
DROP USER mysqltest_u1@localhost;
--disconnect con1
--connection default
USE test;
--echo # End of 5.1 tests.

View File

@ -21,9 +21,9 @@ connection mqph2;
select * from t1;
ERROR 42000: User 'mysqltest_1' has exceeded the 'max_queries_per_hour' resource (current value: 2)
connection default;
drop user mysqltest_1@localhost;
disconnect mqph;
disconnect mqph2;
drop user mysqltest_1@localhost;
create user mysqltest_1@localhost;
grant all on test.* to mysqltest_1@localhost with max_updates_per_hour 2;
flush user_resources;
@ -48,9 +48,9 @@ ERROR 42000: User 'mysqltest_1' has exceeded the 'max_updates_per_hour' resource
select * from t1;
i
connection default;
drop user mysqltest_1@localhost;
disconnect muph;
disconnect muph2;
drop user mysqltest_1@localhost;
create user mysqltest_1@localhost;
grant all on test.* to mysqltest_1@localhost with max_connections_per_hour 2;
flush user_resources;

View File

@ -36,9 +36,9 @@ connection mqph2;
select * from t1;
# cleanup
connection default;
drop user mysqltest_1@localhost;
disconnect mqph;
disconnect mqph2;
drop user mysqltest_1@localhost;
# Test of MAX_UPDATES_PER_HOUR limit
create user mysqltest_1@localhost;
@ -61,9 +61,9 @@ delete from t1;
select * from t1;
# Cleanup
connection default;
drop user mysqltest_1@localhost;
disconnect muph;
disconnect muph2;
drop user mysqltest_1@localhost;
# Test of MAX_CONNECTIONS_PER_HOUR limit
create user mysqltest_1@localhost;

View File

@ -2900,12 +2900,12 @@ connection root;
SELECT * FROM t1;
x
1
disconnect user21261;
DROP USER 'user21261'@'localhost';
DROP DATABASE bug21261DB;
disconnect root;
connection default;
USE test;
disconnect root;
disconnect user21261;
set GLOBAL sql_mode=default;
set LOCAL sql_mode=default;
create table t1 (f1 datetime);

View File

@ -2769,12 +2769,12 @@ connection user21261;
UPDATE v1,t2 SET x=1 WHERE x=y;
connection root;
SELECT * FROM t1;
disconnect user21261;
DROP USER 'user21261'@'localhost';
DROP DATABASE bug21261DB;
disconnect root;
connection default;
USE test;
disconnect root;
disconnect user21261;
set GLOBAL sql_mode=default;
set LOCAL sql_mode=default;

View File

@ -55,6 +55,7 @@ c
select d from mysqltest.v1;
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'd' in table 'v1'
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
create database mysqltest;
@ -62,7 +63,7 @@ create table mysqltest.t1 (a int, b int);
create algorithm=temptable view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
create user mysqltest_1@localhost;
grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1;
connect user1,localhost,mysqltest_1,,mysqltest;
select c from mysqltest.v1;
c
select d from mysqltest.v1;
@ -189,9 +190,9 @@ show create view mysqltest.v4;
View Create View character_set_client collation_connection
v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t2`.`a` + 1 AS `c`,`t2`.`b` + 1 AS `d` from `t2` latin1 latin1_swedish_ci
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
insert into mysqltest.t1 values (10,2), (20,3), (30,4), (40,5), (50,10);
@ -250,9 +251,9 @@ ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table `
update v3 set a=a+c;
ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v3`
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
create database mysqltest;
create table mysqltest.t1 (a int, b int, primary key(a));
insert into mysqltest.t1 values (1,2), (2,3), (3,4), (4,5), (5,10);
@ -314,9 +315,9 @@ ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table `
insert into v2 select x,y from t2;
ERROR 42000: INSERT command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v2`
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
connection root;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
@ -355,10 +356,10 @@ grant update,select(b) on mysqltest.t2 to mysqltest_1@localhost;
connection user1;
create view v4 as select b+1 from mysqltest.t2;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
drop view v1,v2,v4;
disconnect user1;
create database mysqltest;
create table mysqltest.t1 (a int);
create user mysqltest_1@localhost;
@ -366,9 +367,9 @@ grant all privileges on mysqltest.* to mysqltest_1@localhost;
connect user1,localhost,mysqltest_1,,mysqltest;
create view v1 as select * from t1;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
create database mysqltest;
create table mysqltest.t1 (a int, b int);
create user mysqltest_1@localhost;
@ -386,10 +387,10 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function
grant select on mysqltest.t1 to mysqltest_1@localhost;
select * from v1;
a b
disconnect user1;
drop user mysqltest_1@localhost;
drop view v1;
drop database mysqltest;
disconnect user1;
create database mysqltest;
use mysqltest;
create table t1 (a int);
@ -422,10 +423,10 @@ ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or fun
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
use test;
disconnect user1;
create database mysqltest;
use mysqltest;
create table t1 (a int);
@ -457,9 +458,9 @@ f2()
NULL
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
use test;
create database mysqltest;
use mysqltest;
@ -491,9 +492,9 @@ a b
1 1
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
create database mysqltest;
use mysqltest;
create table t1 (a int);
@ -523,10 +524,10 @@ ERROR HY000: View 'mysqltest.v4' references invalid table(s) or column(s) or fun
select * from v5;
ERROR HY000: View 'mysqltest.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
use test;
disconnect user1;
create user 'test14256'@'%';
grant all on test.* to 'test14256'@'%';
connect test14256,localhost,test14256,,test;
@ -567,10 +568,10 @@ SHOW CREATE TABLE v1;
ERROR 42000: SHOW VIEW command denied to user 'mysqltest_1'@'localhost' for table `mysqltest`.`v1`
UNLOCK TABLES;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
use test;
disconnect user1;
disconnect root;
connection default;
create definer=some_user@`` sql security invoker view v1 as select 1;
@ -888,9 +889,9 @@ connection root;
SHOW CREATE VIEW v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
disconnect u1;
DROP USER u26813@localhost;
DROP DATABASE db26813;
disconnect u1;
#
# Bug#29908 A user can gain additional access through the ALTER VIEW.
#
@ -935,11 +936,11 @@ ALTER VIEW v2 AS SELECT f1 FROM t1;
SHOW CREATE VIEW v2;
View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1` latin1 latin1_swedish_ci
disconnect u1;
disconnect u2;
DROP USER u29908_1@localhost;
DROP USER u29908_2@localhost;
DROP DATABASE mysqltest_29908;
disconnect u1;
disconnect u2;
#######################################################################
CREATE DATABASE mysqltest1;
CREATE DATABASE mysqltest2;

View File

@ -78,6 +78,7 @@ select c from mysqltest.v1;
select d from mysqltest.v1;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
@ -88,7 +89,7 @@ create algorithm=temptable view mysqltest.v1 (c,d) as select a+1,b+1 from mysqlt
create user mysqltest_1@localhost;
grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
connection user1;
connect (user1,localhost,mysqltest_1,,mysqltest);
select c from mysqltest.v1;
# there are no privileges on column 'd'
--error ER_COLUMNACCESS_DENIED_ERROR
@ -211,9 +212,9 @@ explain select c from mysqltest.v4;
show create view mysqltest.v4;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
#
# UPDATE privileges on VIEW columns and whole VIEW
@ -260,9 +261,9 @@ update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
update v3 set a=a+c;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
#
# DELETE privileges on VIEW
@ -326,9 +327,9 @@ insert into v2 values (5,6);
insert into v2 select x,y from t2;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
#
# test of CREATE VIEW privileges if we have limited privileges
@ -386,10 +387,10 @@ connection user1;
create view v4 as select b+1 from mysqltest.t2;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
drop view v1,v2,v4;
disconnect user1;
#
# user with global DB privileges
@ -403,9 +404,9 @@ connect (user1,localhost,mysqltest_1,,mysqltest);
create view v1 as select * from t1;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
#
# view definer grants revoking
@ -430,10 +431,10 @@ select * from v1;
grant select on mysqltest.t1 to mysqltest_1@localhost;
select * from v1;
disconnect user1;
drop user mysqltest_1@localhost;
drop view v1;
drop database mysqltest;
disconnect user1;
#
# rights on execution of view underlying functions (Bug#9505)
@ -473,10 +474,10 @@ select * from v4;
select * from v5;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
use test;
disconnect user1;
#
# revertion of previous test, definer of view lost his/her rights to execute
@ -518,10 +519,10 @@ select * from v4;
--error ER_VIEW_INVALID
select * from v5;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
use test;
disconnect user1;
#
# definer/invoker rights for columns
@ -556,9 +557,9 @@ select * from v4;
--error ER_VIEW_INVALID
select * from v5;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
disconnect user1;
create database mysqltest;
@ -588,10 +589,10 @@ select * from v4;
select * from v5;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
use test;
disconnect user1;
#
# Bug#14256 definer in view definition is not fully qualified
@ -650,6 +651,7 @@ SHOW CREATE TABLE v1;
UNLOCK TABLES;
connection root;
disconnect user1;
drop user mysqltest_1@localhost;
drop database mysqltest;
use test;
@ -657,7 +659,6 @@ use test;
#
# switch to default connection
#
disconnect user1;
disconnect root;
connection default;
@ -1022,9 +1023,9 @@ ALTER VIEW v3 AS SELECT f2 FROM t1;
connection root;
SHOW CREATE VIEW v3;
disconnect u1;
DROP USER u26813@localhost;
DROP DATABASE db26813;
disconnect u1;
--echo #
--echo # Bug#29908 A user can gain additional access through the ALTER VIEW.
@ -1064,11 +1065,11 @@ SHOW CREATE VIEW v1;
ALTER VIEW v2 AS SELECT f1 FROM t1;
SHOW CREATE VIEW v2;
disconnect u1;
disconnect u2;
DROP USER u29908_1@localhost;
DROP USER u29908_2@localhost;
DROP DATABASE mysqltest_29908;
disconnect u1;
disconnect u2;
--echo #######################################################################
#

View File

@ -142,6 +142,7 @@ connection user1;
connection default;
include/diff_tables.inc [t1,t2]
# Test cleanup
disconnect user1;
DROP TABLE t2,t1;
DROP USER user1@localhost;
#

View File

@ -193,6 +193,7 @@ call mtr.add_suppression("Access denied; you need (at least one of) the BINLOG R
--echo # Test cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
--disconnect user1
DROP TABLE t2,t1;
DROP USER user1@localhost;

View File

@ -34,6 +34,7 @@ a users
3 tester@localhost
4 @localhost%
connection master;
disconnect m_1;
DROP DATABASE mysqltest1;
REVOKE ALL ON mysqltest1.* FROM 'tester'@'%';
REVOKE ALL ON mysqltest1.* FROM ''@'localhost%';

View File

@ -336,6 +336,7 @@ a
connection master;
drop procedure foo;
connection slave;
disconnect con1;
connection master;
drop function fn1;
drop database mysqltest1;

View File

@ -85,6 +85,7 @@ select * from t2 ORDER BY f;
f
5
7
disconnect con3;
drop table t1, t2;
drop user zedjzlcsjhd@localhost;
use test;

View File

@ -489,6 +489,8 @@ delete from tb3 where f121='Test 3.5.7.15/16';
Testcase 3.5.7.17 (see Testcase 3.5.1.1)
----------------------------------------
connection default;
disconnect con1_general;
disconnect con1_super;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;

View File

@ -535,6 +535,8 @@ Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
connection default;
disconnect con2_general;
disconnect con2_super;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;

View File

@ -147,6 +147,7 @@ a
2
SELECT * FROM information_schema.check_constraints;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME LEVEL CHECK_CLAUSE
disconnect con1;
connection default;
DROP USER foo;
DROP DATABASE db;

View File

@ -31,5 +31,6 @@ Database (mysql)
SHOW DATABASES LIKE 'test';
Database (test)
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;

View File

@ -32,5 +32,6 @@ Database (mysql)
SHOW DATABASES LIKE 'test';
Database (test)
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;

View File

@ -36,5 +36,6 @@ Database (mysql)
SHOW DATABASES LIKE 'test';
Database (test)
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;

View File

@ -489,6 +489,8 @@ delete from tb3 where f121='Test 3.5.7.15/16';
Testcase 3.5.7.17 (see Testcase 3.5.1.1)
----------------------------------------
connection default;
disconnect con1_general;
disconnect con1_super;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;

View File

@ -535,6 +535,8 @@ Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
connection default;
disconnect con2_general;
disconnect con2_super;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;

View File

@ -489,6 +489,8 @@ delete from tb3 where f121='Test 3.5.7.15/16';
Testcase 3.5.7.17 (see Testcase 3.5.1.1)
----------------------------------------
connection default;
disconnect con1_general;
disconnect con1_super;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;

View File

@ -535,6 +535,8 @@ Rollback;
END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger
connection default;
disconnect con2_general;
disconnect con2_super;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;

View File

@ -114,6 +114,7 @@ SELECT a FROM t1;
--sorted_result
SELECT * FROM information_schema.check_constraints;
disconnect con1;
--connection default
DROP USER foo;

View File

@ -51,5 +51,6 @@ eval $my_show3;
# Cleanup
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;

View File

@ -54,5 +54,6 @@ eval $my_show3;
# Cleanup
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;

View File

@ -55,5 +55,6 @@ eval $my_show3;
# Cleanup
connection default;
disconnect testuser1;
DROP USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;

View File

@ -604,6 +604,8 @@ let $message= Testcase 3.5.7.17 (see Testcase 3.5.1.1);
# Cleanup section 3.5
connection default;
disconnect con1_general;
disconnect con1_super;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;

View File

@ -559,6 +559,8 @@ let $message= Testcase 3.5.8.7;
# Cleanup section 3.5
connection default;
disconnect con2_general;
disconnect con2_super;
drop user test_general@localhost;
drop user test_general;
drop user test_super@localhost;

View File

@ -263,6 +263,7 @@ select count(*) > -1 from d_trx;
count(*) > -1
1
connection default;
disconnect select_only;
SET GLOBAL innodb_max_purge_lag_wait=0;
drop database test;
create database test;

View File

@ -270,6 +270,7 @@ select count(*) > -1 from i_trx;
select count(*) > -1 from d_trx;
connection default;
disconnect select_only;
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
SET GLOBAL innodb_max_purge_lag_wait=0;
drop database test;

View File

@ -951,6 +951,10 @@ where THREAD_ID = $con4_thread_id;
count(*)
0
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
disconnect con4;
drop user user1@localhost;
drop user user2@localhost;
drop user user3@localhost;

View File

@ -649,6 +649,10 @@ evalp select /*4-3*/ count(*) from performance_schema.events_waits_history_long
where THREAD_ID = $con4_thread_id;
--connection default
--disconnect con1
--disconnect con2
--disconnect con3
--disconnect con4
drop user user1@localhost;
drop user user2@localhost;

View File

@ -17,6 +17,7 @@ user() tt@localhost
current_user() zzzzzzzzzzzzzzzz@%
@@external_user oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.
connection default;
disconnect c1;
drop user tt;
drop user zzzzzzzzzzzzzzzz;
uninstall plugin auth_0x0100;

View File

@ -43,6 +43,7 @@ select count(*) from information_schema.query_cache_info;
count(*)
0
connection default;
disconnect conn1;
drop user mysqltest;
drop table t1;
set @@global.query_cache_size=@save_query_cache_size;

View File

@ -23,6 +23,7 @@ connection c1;
--query_vertical select user(), current_user(), @@external_user
connection default;
disconnect c1;
drop user tt;
drop user zzzzzzzzzzzzzzzz;
uninstall plugin auth_0x0100;

View File

@ -10,6 +10,7 @@ connection conn1;
select a from t1;
select count(*) from information_schema.query_cache_info;
connection default;
disconnect conn1;
drop user mysqltest;
drop table t1;

View File

@ -152,4 +152,5 @@ revoke role2 from current_user;
revoke role4 from current_user;
grant role4 to current_user;
drop role role1, role2, role3, role4, role5, role6;
disconnect c1;
drop user foo@localhost;

View File

@ -99,4 +99,5 @@ grant role4 to current_user;
# cleanup
########################################
drop role role1, role2, role3, role4, role5, role6;
disconnect c1;
drop user foo@localhost;

View File

@ -747,6 +747,9 @@ drop role r1;
drop role r2;
drop role r3;
drop role user_like_role;
disconnect foo;
disconnect user1;
disconnect user_like_role;
drop user user1;
drop user foo;
drop user user_like_role;

View File

@ -459,6 +459,9 @@ drop role r1;
drop role r2;
drop role r3;
drop role user_like_role;
disconnect foo;
disconnect user1;
disconnect user_like_role;
drop user user1;
drop user foo;
drop user user_like_role;

View File

@ -76,6 +76,7 @@ set role r1;
select mysql.test_func("r1");
ERROR 42000: execute command denied to user 'u1'@'%' for routine 'mysql.test_func'
connection default;
disconnect u1;
drop function mysql.test_func;
drop role r1, r2, r3;
drop user u1;

View File

@ -63,6 +63,7 @@ set role r1;
select mysql.test_func("r1");
connection default;
disconnect u1;
drop function mysql.test_func;
drop role r1, r2, r3;
drop user u1;

View File

@ -479,6 +479,9 @@ SELECT COUNT(1) FROM oms_live_th.d;
COUNT(1)
0
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
DROP DATABASE bob_live_sg;
DROP DATABASE oms_live_sg;
DROP DATABASE bob_live_ph;

View File

@ -316,6 +316,10 @@ SELECT COUNT(1) FROM oms_live_th.b;
SELECT COUNT(1) FROM oms_live_th.c;
SELECT COUNT(1) FROM oms_live_th.d;
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
DROP DATABASE bob_live_sg;
DROP DATABASE oms_live_sg;

View File

@ -29,6 +29,7 @@ GRANT ALL PRIVILEGES ON `mysqltest2`.* TO `r2`
GRANT USAGE ON *.* TO `r1`
GRANT ALL PRIVILEGES ON `mysqltest1`.* TO `r1`
connection default;
disconnect foo;
drop user foo@localhost;
drop role r1;
drop role r2;

View File

@ -25,6 +25,7 @@ show tables in mysqltest2;
show grants;
connection default;
disconnect foo;
drop user foo@localhost;
drop role r1;
drop role r2;

View File

@ -12,5 +12,6 @@ Grants for @localhost
GRANT `r1` TO ``@`localhost`
GRANT USAGE ON *.* TO ``@`localhost`
connection default;
disconnect con1;
drop role r1;
drop user ''@localhost;

View File

@ -18,5 +18,6 @@ select current_user;
show grants;
connection default;
disconnect con1;
drop role r1;
drop user ''@localhost;

View File

@ -76,6 +76,7 @@ ERROR 28000: Can't find any matching row in the user table
grant auto_create to foo2@localhost identified by 'pass';
ERROR 42000: You are not allowed to create a user with GRANT
connection default;
disconnect con1;
drop user foo@localhost;
drop user bar@localhost;
drop role auto_create;

View File

@ -116,6 +116,7 @@ grant auto_create to foo2@localhost identified by 'pass';
--connection default
--disconnect con1
drop user foo@localhost;
drop user bar@localhost;
drop role auto_create;

View File

@ -11,5 +11,6 @@ select * from information_schema.enabled_roles;
ROLE_NAME
r1
connection default;
disconnect con1;
drop user foo@'127.0.0.1';
drop role r1;

View File

@ -12,5 +12,6 @@ set role r1;
select * from information_schema.enabled_roles;
connection default;
disconnect con1;
drop user foo@'127.0.0.1';
drop role r1;

View File

@ -245,6 +245,7 @@ show status like 'debug%';
#
connection default;
disconnect foo;
drop user foo@localhost;
drop role role1;
drop role role2;

View File

@ -353,6 +353,7 @@ revoke select on test.* from role1;
show status like 'debug%';
Variable_name Value
connection default;
disconnect foo;
drop user foo@localhost;
drop role role1;
drop role role2;

View File

@ -472,6 +472,7 @@ Debug_role_merges_table 67
Debug_role_merges_column 30
Debug_role_merges_routine 28
connection default;
disconnect foo;
drop user foo@localhost;
drop role role1;
drop role role2;

View File

@ -54,6 +54,7 @@ Some Secret P4ssw0rd
insert into secret_db.t1 values ("|_33T|-|4><");
ERROR 42000: INSERT command denied to user 'test_user'@'localhost' for table `secret_db`.`t1`
connection default;
disconnect test_user;
drop role test_ROLE;
drop role test_role;
drop user test_user;

View File

@ -46,6 +46,7 @@ select * from secret_db.t1 order by secret;
insert into secret_db.t1 values ("|_33T|-|4><");
connection default;
disconnect test_user;
drop role test_ROLE;
drop role test_role;

View File

@ -47,6 +47,7 @@ GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO `simple`
create database t;
drop database t;
connection default;
disconnect foo;
drop role simple;
drop role admin;
drop user foo;

View File

@ -43,6 +43,7 @@ create database t;
drop database t;
connection default;
disconnect foo;
drop role simple;
drop role admin;
drop user foo;

View File

@ -90,6 +90,8 @@ use bug_db;
# Cleanup
#
connection default;
disconnect john;
disconnect usertestjohn;
drop user john;
drop user usertestjohn;
drop role client;

View File

@ -71,6 +71,8 @@ use bug_db;
--echo # Cleanup
--echo #
connection default;
disconnect john;
disconnect usertestjohn;
drop user john;
drop user usertestjohn;
drop role client;

Some files were not shown because too many files have changed in this diff Show More