fix error messages

when a definer for SP/view is wrong - it shold be ER_MALFORMED_DEFINER,
not ER_NO_SUCH_USER

when one uses current_role as a definer or grantee but there's no
current role - it should be ER_INVALID_ROLE not ER_MALFORMED_DEFINER

when a non-existent user is specified - it should be ER_NO_SUCH_USER,
which should say "The user does not exist", not "Definer does not exist"

clarify ER_CANT_CHANGE_TX_CHARACTERISTICS to say what cannot be changed
This commit is contained in:
Sergei Golubchik 2025-03-02 17:47:03 +01:00
parent 02b81afff8
commit 78d23a3e60
31 changed files with 120 additions and 116 deletions

View File

@ -145,6 +145,7 @@ typedef unsigned long long my_ulonglong;
#define ER_DROP_PARTITION_NON_EXISTENT ER_PARTITION_DOES_NOT_EXIST
#define ER_SPATIAL_CANT_HAVE_NULL ER_INDEX_CANNOT_HAVE_NULL
#define ER_INNODB_NO_FT_TEMP_TABLE ER_NO_INDEX_ON_TEMPORARY
#define ER_CANT_CHANGE_TX_CHARACTERISTICS ER_CANT_SET_IN_TRANSACTION
typedef struct st_mysql_rows {
struct st_mysql_rows *next; /* list of rows */

View File

@ -13,7 +13,7 @@ INSERT INTO t1 VALUES (1),(2);
COMMIT;
START TRANSACTION;
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
ERROR 25001: Transaction characteristics can't be changed while a transaction is in progress
ERROR 25001: TRANSACTION ISOLATION can't be set while a transaction is in progress
COMMIT;
SET @@autocommit=0;
COMMIT;
@ -328,7 +328,9 @@ SELECT @@transaction_read_only;
START TRANSACTION;
# Not allowed inside a transaction
SET TRANSACTION READ ONLY;
ERROR 25001: Transaction characteristics can't be changed while a transaction is in progress
ERROR 25001: TRANSACTION READ ONLY can't be set while a transaction is in progress
SET TRANSACTION READ WRITE;
ERROR 25001: TRANSACTION READ WRITE can't be set while a transaction is in progress
# But these are allowed.
SET SESSION TRANSACTION READ ONLY;
SET GLOBAL TRANSACTION READ ONLY;

View File

@ -28,7 +28,7 @@ COMMIT;
# inside a transaction
#
START TRANSACTION;
--error ER_CANT_CHANGE_TX_CHARACTERISTICS
--error ER_CANT_SET_IN_TRANSACTION
SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;
COMMIT;
@ -383,8 +383,10 @@ SELECT @@transaction_read_only;
START TRANSACTION;
--echo # Not allowed inside a transaction
--error ER_CANT_CHANGE_TX_CHARACTERISTICS
--error ER_CANT_SET_IN_TRANSACTION
SET TRANSACTION READ ONLY;
--error ER_CANT_SET_IN_TRANSACTION
SET TRANSACTION READ WRITE;
--echo # But these are allowed.
SET SESSION TRANSACTION READ ONLY;
SET GLOBAL TRANSACTION READ ONLY;

View File

@ -1,25 +1,25 @@
CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user1;
Warnings:
Note 1449 The user specified as a definer ('user1'@'%') does not exist
Note 1446 The user specified as a definer ('user1'@'%') does not exist
SELECT * FROM mysql.roles_mapping;
Host User Role Admin_option
% user1 role1 Y
DROP ROLE role1;
CREATE OR REPLACE ROLE role1 WITH ADMIN user2;
Warnings:
Note 1449 The user specified as a definer ('user2'@'%') does not exist
Note 1446 The user specified as a definer ('user2'@'%') does not exist
SELECT * FROM mysql.roles_mapping WHERE Role='role1';
Host User Role Admin_option
% user2 role1 Y
CREATE OR REPLACE ROLE role1 WITH ADMIN user3;
Warnings:
Note 1449 The user specified as a definer ('user3'@'%') does not exist
Note 1446 The user specified as a definer ('user3'@'%') does not exist
SELECT * FROM mysql.roles_mapping WHERE Role='role1';
Host User Role Admin_option
% user3 role1 Y
CREATE ROLE IF NOT EXISTS role1 WITH ADMIN user4;
Warnings:
Note 1449 The user specified as a definer ('user4'@'%') does not exist
Note 1446 The user specified as a definer ('user4'@'%') does not exist
Note 1975 Can't create role 'role1'; it already exists
SELECT * FROM mysql.roles_mapping WHERE Role='role1';
Host User Role Admin_option

View File

@ -113,7 +113,7 @@ grant select, show view on v6 to testdb_2@localhost;
create table t2 (f1 char(4));
create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
Note 1446 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
show fields from testdb_1.v6;
Field Type Null Key Default Extra
f1 char(4) YES NULL
@ -124,12 +124,12 @@ show create view testdb_1.v7;
View Create View character_set_client collation_connection
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
Note 1446 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
show fields from testdb_1.v7;
Field Type Null Key Default Extra
f1 char(4) YES NULL
Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
Note 1446 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
connection testdb_1;
create table t3 (f1 char(4), f2 char(4));
create view v3 as select f1,f2 from t3;
@ -154,12 +154,12 @@ show fields from testdb_1.v7;
Field Type Null Key Default Extra
f1 char(4) YES NULL
Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
Note 1446 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
show create view testdb_1.v7;
View Create View character_set_client collation_connection
v7 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v7` AS select `testdb_1`.`t2`.`f1` AS `f1` from `t2` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
Note 1446 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
revoke insert(f1) on v3 from testdb_2@localhost;
revoke select,show view on v5 from testdb_2@localhost;
connection default;

View File

@ -3,11 +3,11 @@ use mysqltest1;
create table t1(id int primary key);
create definer=unknownuser@'%' sql security definer view v1 as select t1.id from t1 group by t1.id;
Warnings:
Note 1449 The user specified as a definer ('unknownuser'@'%') does not exist
Note 1446 The user specified as a definer ('unknownuser'@'%') does not exist
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL utf8mb4_uca1400_ai_ci NULL # N
v1 NULL NULL NULL NULL NULL NULL # NULL NULL NULL # # NULL NULL NULL NULL VIEW # NULL
Warnings:
Note 1449 The user specified as a definer ('unknownuser'@'%') does not exist
Note 1446 The user specified as a definer ('unknownuser'@'%') does not exist
drop database mysqltest1;

View File

@ -439,10 +439,10 @@ connection mysqltest_2_con;
use mysqltest;
CREATE DEFINER='a @ b @ c'@localhost PROCEDURE wl2897_p3() SELECT 3;
Warnings:
Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exist
Note 1446 The user specified as a definer ('a @ b @ c'@'localhost') does not exist
CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;
Warnings:
Note 1449 The user specified as a definer ('a @ b @ c'@'localhost') does not exist
Note 1446 The user specified as a definer ('a @ b @ c'@'localhost') does not exist
connection con1root;
USE mysqltest;
SHOW CREATE PROCEDURE wl2897_p1;
@ -836,7 +836,7 @@ set @cmd:="create definer=u function f(i int) returns char binary reads sql data
prepare s from @cmd;
execute s;
Warnings:
Note 1449 The user specified as a definer ('u'@'%') does not exist
Note 1446 The user specified as a definer ('u'@'%') does not exist
execute s;
ERROR 42000: FUNCTION f already exists
drop function f;

View File

@ -722,10 +722,10 @@ DROP USER mysqltest_1@localhost;
USE mysqltest;
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
CALL bug13198_p1();
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
SELECT bug13198_f1();
# Cleanup.

View File

@ -128,7 +128,7 @@ CREATE DEFINER='mysqltest_nonexs'@'localhost'
FOR EACH ROW
SET @new_sum = 0;
Warnings:
Note 1449 The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist
Note 1446 The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist
INSERT INTO t1 VALUES(6);
ERROR HY000: The user specified as a definer ('mysqltest_nonexs'@'localhost') does not exist
SHOW TRIGGERS;

View File

@ -275,7 +275,7 @@ CREATE DEFINER='mysqltest_nonexs'@'localhost'
# Check that trg2 will not be activated.
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
INSERT INTO t1 VALUES(6);
#

View File

@ -612,10 +612,10 @@ disconnect root;
connection default;
create definer=some_user@`` sql security invoker view v1 as select 1;
Warnings:
Note 1449 The user specified as a definer ('some_user'@'%') does not exist
Note 1446 The user specified as a definer ('some_user'@'%') does not exist
create definer=some_user@localhost sql security invoker view v2 as select 1;
Warnings:
Note 1449 The user specified as a definer ('some_user'@'localhost') does not exist
Note 1446 The user specified as a definer ('some_user'@'localhost') does not exist
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`%` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1` latin1 latin1_swedish_ci
@ -703,12 +703,12 @@ CREATE TABLE t1 (a INT PRIMARY KEY);
INSERT INTO t1 VALUES (1), (2), (3);
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
Warnings:
Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist
Note 1446 The user specified as a definer ('no-such-user'@'localhost') does not exist
SHOW CREATE VIEW v;
View Create View character_set_client collation_connection
v CREATE ALGORITHM=UNDEFINED DEFINER=`no-such-user`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no-such-user'@'localhost') does not exist
Note 1446 The user specified as a definer ('no-such-user'@'localhost') does not exist
SELECT * FROM v;
ERROR HY000: The user specified as a definer ('no-such-user'@'localhost') does not exist
DROP VIEW v;
@ -1368,28 +1368,28 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
ALTER DEFINER=no_such@user_1 VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
Note 1446 The user specified as a definer ('no_such'@'user_1') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
Note 1446 The user specified as a definer ('no_such'@'user_1') does not exist
ALTER ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
Note 1446 The user specified as a definer ('no_such'@'user_1') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=MERGE DEFINER=`no_such`@`user_1` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_1') does not exist
Note 1446 The user specified as a definer ('no_such'@'user_1') does not exist
ALTER ALGORITHM=TEMPTABLE DEFINER=no_such@user_2 VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist
Note 1446 The user specified as a definer ('no_such'@'user_2') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=TEMPTABLE DEFINER=`no_such`@`user_2` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`i` AS `i` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no_such'@'user_2') does not exist
Note 1446 The user specified as a definer ('no_such'@'user_2') does not exist
DROP VIEW v1;
DROP TABLE t1;
CREATE USER mysqluser1@localhost;
@ -1643,12 +1643,12 @@ USE test;
CREATE TABLE t1( a INT );
CREATE DEFINER = no_such_user@no_such_host VIEW v1 AS SELECT * FROM t1;
Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
Note 1446 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`no_such_user`@`no_such_host` SQL SECURITY DEFINER VIEW `v1` AS select `test`.`t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
Note 1446 The user specified as a definer ('no_such_user'@'no_such_host') does not exist
DROP TABLE t1;
DROP VIEW v1;
#
@ -1680,7 +1680,7 @@ USE test;
DROP VIEW IF EXISTS v1;
CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1;
Warnings:
Note 1449 The user specified as a definer ('unknown'@'unknown') does not exist
Note 1446 The user specified as a definer ('unknown'@'unknown') does not exist
LOCK TABLES v1 READ;
ERROR HY000: The user specified as a definer ('unknown'@'unknown') does not exist
DROP VIEW v1;

View File

@ -848,7 +848,7 @@ INSERT INTO t1 VALUES (1), (2), (3);
CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
#--warning ER_VIEW_OTHER_USER
SHOW CREATE VIEW v;
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
SELECT * FROM v;
DROP VIEW v;
DROP TABLE t1;
@ -1013,13 +1013,13 @@ connection inv2;
SHOW GRANTS;
SELECT CURRENT_USER, SYSTEM_USER(), USER();
--echo for a user with SET USER
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
SELECT * FROM v1;
disconnect inv2;
connection root;
--echo for a superuser
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
SELECT * FROM v1;
DROP USER inv_17254@localhost;
DROP DATABASE db17254;
@ -1937,7 +1937,7 @@ DROP VIEW IF EXISTS v1;
--enable_warnings
CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1;
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
LOCK TABLES v1 READ;
DROP VIEW v1;

View File

@ -50,7 +50,7 @@ PROCEDURE p1;
END;
$$
Warnings:
Note 1449 The user specified as a definer ('xxx'@'localhost') does not exist
Note 1446 The user specified as a definer ('xxx'@'localhost') does not exist
CREATE DEFINER=xxx@localhost PACKAGE BODY p1 AS
PROCEDURE p1 AS
BEGIN
@ -59,7 +59,7 @@ END;
END;
$$
Warnings:
Note 1449 The user specified as a definer ('xxx'@'localhost') does not exist
Note 1446 The user specified as a definer ('xxx'@'localhost') does not exist
DROP PACKAGE p1;
#
# Creating a package with a different DEFINER, with SQL SECURITY INVOKER
@ -69,7 +69,7 @@ PROCEDURE p1;
END;
$$
Warnings:
Note 1449 The user specified as a definer ('xxx'@'localhost') does not exist
Note 1446 The user specified as a definer ('xxx'@'localhost') does not exist
CREATE DEFINER=xxx@localhost PACKAGE BODY p1 SQL SECURITY INVOKER AS
PROCEDURE p1 AS
BEGIN
@ -78,7 +78,7 @@ END;
END;
$$
Warnings:
Note 1449 The user specified as a definer ('xxx'@'localhost') does not exist
Note 1446 The user specified as a definer ('xxx'@'localhost') does not exist
DROP PACKAGE p1;
#
# Creating a new package in a remote database

View File

@ -139,7 +139,7 @@ PROCEDURE p1;
END;
$$
Warnings:
Note 1449 The user specified as a definer ('xxx'@'localhost') does not exist
Note 1446 The user specified as a definer ('xxx'@'localhost') does not exist
CREATE DEFINER=xxx@localhost PACKAGE BODY p1 AS
PROCEDURE p1 AS
BEGIN
@ -148,7 +148,7 @@ END;
END;
$$
Warnings:
Note 1449 The user specified as a definer ('xxx'@'localhost') does not exist
Note 1446 The user specified as a definer ('xxx'@'localhost') does not exist
SELECT definer, name, security_type, type FROM mysql.proc WHERE name LIKE 'p1%' ORDER BY definer, name, type;
definer name security_type type
xxx@localhost p1 DEFINER PACKAGE
@ -170,7 +170,7 @@ PROCEDURE p1;
END;
$$
Warnings:
Note 1449 The user specified as a definer ('xxx'@'localhost') does not exist
Note 1446 The user specified as a definer ('xxx'@'localhost') does not exist
CREATE DEFINER=xxx@localhost PACKAGE BODY p1 SQL SECURITY INVOKER AS
PROCEDURE p1 AS
BEGIN
@ -179,7 +179,7 @@ END;
END;
$$
Warnings:
Note 1449 The user specified as a definer ('xxx'@'localhost') does not exist
Note 1446 The user specified as a definer ('xxx'@'localhost') does not exist
SELECT definer, name, security_type, type FROM mysql.proc WHERE name LIKE 'p1%' ORDER BY definer, name, type;
definer name security_type type
xxx@localhost p1 INVOKER PACKAGE

View File

@ -1313,7 +1313,7 @@ create definer=not_ex_user@localhost trigger trg1_0
before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
Warnings:
Note 1449 The user specified as a definer ('not_ex_user'@'localhost') does not exist
Note 1446 The user specified as a definer ('not_ex_user'@'localhost') does not exist
drop trigger trg1_0;
create definer=test_yesprivs@localhost trigger trg1_0
before INSERT on t1 for each row

View File

@ -1314,7 +1314,7 @@ create definer=not_ex_user@localhost trigger trg1_0
before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
Warnings:
Note 1449 The user specified as a definer ('not_ex_user'@'localhost') does not exist
Note 1446 The user specified as a definer ('not_ex_user'@'localhost') does not exist
drop trigger trg1_0;
create definer=test_yesprivs@localhost trigger trg1_0
before INSERT on t1 for each row

View File

@ -1314,7 +1314,7 @@ create definer=not_ex_user@localhost trigger trg1_0
before INSERT on t1 for each row
set new.f1 = 'trig 1_0-yes';
Warnings:
Note 1449 The user specified as a definer ('not_ex_user'@'localhost') does not exist
Note 1446 The user specified as a definer ('not_ex_user'@'localhost') does not exist
drop trigger trg1_0;
create definer=test_yesprivs@localhost trigger trg1_0
before INSERT on t1 for each row

View File

@ -3,7 +3,7 @@ grant create user on *.* to foo@localhost;
create role role1;
create role role2 with admin current_user;
create role role3 with admin current_role;
ERROR 0L000: Invalid definer
ERROR OP000: Invalid role specification `NONE`
create role role3 with admin role1;
create role role4 with admin root@localhost;
connect c1, localhost, foo,,;
@ -16,7 +16,7 @@ connection default;
call mtr.add_suppression("Invalid roles_mapping table entry user:'foo@bar', rolename:'role6'");
create role role6 with admin foo@bar;
Warnings:
Note 1449 The user specified as a definer ('foo'@'bar') does not exist
Note 1446 The user specified as a definer ('foo'@'bar') does not exist
create user bar with admin 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 'admin current_user' at line 1
grant role1 to foo@localhost with admin option;

View File

@ -9,7 +9,7 @@ grant create user on *.* to foo@localhost;
create role role1;
create role role2 with admin current_user;
--error ER_MALFORMED_DEFINER
--error ER_INVALID_ROLE
create role role3 with admin current_role;
create role role3 with admin role1;
create role role4 with admin root@localhost;

View File

@ -17,7 +17,7 @@ drop role current_role;
ERROR HY000: Operation DROP ROLE failed for CURRENT_ROLE
show warnings;
Level Code Message
Error 1446 Invalid definer
Error 1959 Invalid role specification `NONE`
Error 1396 Operation DROP ROLE failed for CURRENT_ROLE
create role r1;
grant r1 to current_user;

View File

@ -49,7 +49,7 @@ ERROR HY000: Operation DROP USER failed for 'r1'@'%'
drop role r1;
create role r1 with admin u1;
Warnings:
Note 1449 The user specified as a definer ('u1'@'%') does not exist
Note 1446 The user specified as a definer ('u1'@'%') does not exist
create user foo@bar;
drop user foo@bar;
drop role r1;

View File

@ -20,7 +20,7 @@ grant select on mysqltest1.t1 to role4;
grant role4 to foo@localhost;
grant select on test.* to role4;
create definer=current_role view test.v1 as select a+b,c from t1;
ERROR 0L000: Invalid definer
ERROR OP000: Invalid role specification `NONE`
set role role1;
create definer=current_role view test.v1 as select a+b,c from t1;
show create view test.v1;
@ -33,12 +33,12 @@ View Create View character_set_client collation_connection
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`role2` SQL SECURITY DEFINER VIEW `test`.`v2` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c`,current_role() AS `current_role()` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
create definer=role3 view test.v3 as select a+b,c from t1;
Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
Note 1446 The user specified as a definer ('role3'@'%') does not exist
show create view test.v3;
View Create View character_set_client collation_connection
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`role3`@`%` SQL SECURITY DEFINER VIEW `test`.`v3` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
Note 1446 The user specified as a definer ('role3'@'%') does not exist
connect c1, localhost, foo,,mysqltest1;
connection c1;
show grants;
@ -85,7 +85,7 @@ show create view test.v5;
View Create View character_set_client collation_connection
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4` SQL SECURITY DEFINER VIEW `test`.`v5` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('role4'@'') does not exist
Note 1446 The user specified as a definer ('role4'@'') does not exist
select * from test.v5;
ERROR HY000: The user specified as a definer ('role4'@'') does not exist
create user role4;
@ -94,7 +94,7 @@ show create view test.v5;
View Create View character_set_client collation_connection
v5 CREATE ALGORITHM=UNDEFINED DEFINER=`role4` SQL SECURITY DEFINER VIEW `test`.`v5` AS select `mysqltest1`.`t1`.`a` + `mysqltest1`.`t1`.`b` AS `a+b`,`mysqltest1`.`t1`.`c` AS `c` from `mysqltest1`.`t1` latin1 latin1_swedish_ci
Warnings:
Note 1449 The user specified as a definer ('role4'@'') does not exist
Note 1446 The user specified as a definer ('role4'@'') does not exist
select * from test.v5;
ERROR HY000: The user specified as a definer ('role4'@'') does not exist
flush tables;
@ -109,7 +109,7 @@ drop user role4;
create table t2 select * from t1;
create definer=current_role trigger tr1 before insert on t2 for each row
insert t1 values (111, 222, 333);
ERROR 0L000: Invalid definer
ERROR OP000: Invalid role specification `NONE`
set role role1;
create definer=current_role trigger tr1 before insert on t2 for each row
insert t1 values (111, 222, 333);
@ -147,7 +147,7 @@ delete from t1 where a=111;
create definer=role3 trigger tr3 before update on t2 for each row
insert t1 values (111, 222, 333);
Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
Note 1446 The user specified as a definer ('role3'@'%') does not exist
show create trigger tr3;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation Created
tr3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role3`@`%` trigger tr3 before update on t2 for each row
@ -176,7 +176,7 @@ select * from t2;
a b c
2 20 200
create definer=current_role procedure pr1() insert t1 values (111, 222, 333);
ERROR 0L000: Invalid definer
ERROR OP000: Invalid role specification `NONE`
set role role1;
create definer=current_role procedure pr1() insert t1 values (111, 222, 333);
show create procedure pr1;
@ -204,7 +204,7 @@ a b c
delete from t1 where a=111;
create definer=role3 procedure pr3() insert t1 values (111, 222, 333);
Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
Note 1446 The user specified as a definer ('role3'@'%') does not exist
show create procedure pr3;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
pr3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role3`@`%` PROCEDURE `pr3`()
@ -219,7 +219,7 @@ update mysql.proc set definer='role2@' where definer='role2';
call pr2();
ERROR HY000: The user specified as a definer ('role2'@'%') does not exist
create definer=current_role function fn1() returns int return (select sum(a+b) from t1);
ERROR 0L000: Invalid definer
ERROR OP000: Invalid role specification `NONE`
set role role1;
create definer=current_role function fn1() returns int return (select sum(a+b) from t1);
show create function fn1;
@ -243,7 +243,7 @@ fn2()
33
create definer=role3 function fn3() returns int return (select sum(a+b) from t1);
Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
Note 1446 The user specified as a definer ('role3'@'%') does not exist
show create function fn3;
Function sql_mode Create Function character_set_client collation_connection Database Collation
fn3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`role3`@`%` FUNCTION `fn3`() RETURNS int(11)
@ -253,7 +253,7 @@ ERROR HY000: The user specified as a definer ('role3'@'%') does not exist
set global event_scheduler=on;
create definer=current_role event e1 on schedule every 1 second starts '2000-01-01' do
insert t1 values (111, 1, 0);
ERROR 0L000: Invalid definer
ERROR OP000: Invalid role specification `NONE`
set role role1;
create definer=current_role event e1 on schedule every 1 second starts '2000-01-01' do
insert t1 values (111, 2, 0);
@ -264,7 +264,7 @@ set role none;
create definer=role3 event e3 on schedule every 1 second starts '2000-01-01' do
insert t1 values (111, 3, 0);
Warnings:
Note 1449 The user specified as a definer ('role3'@'%') does not exist
Note 1446 The user specified as a definer ('role3'@'%') does not exist
show create event e3;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e3 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`role3`@`%` EVENT `e3` ON SCHEDULE EVERY 1 SECOND STARTS '2000-01-01 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO insert t1 values (111, 3, 0) latin1 latin1_swedish_ci utf8mb4_uca1400_ai_ci

View File

@ -45,7 +45,7 @@ grant select on test.* to role4;
##################################################
# no current role = error
--error ER_MALFORMED_DEFINER
--error ER_INVALID_ROLE
create definer=current_role view test.v1 as select a+b,c from t1;
# definer=current_role, but it has doesn't have enough privileges
@ -105,13 +105,13 @@ connection default;
drop role role4;
show create view test.v5;
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
select * from test.v5;
create user role4;
grant select on mysqltest1.t1 to role4;
show create view test.v5;
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
select * from test.v5;
# pretend it's an old view from before 10.0.5
@ -138,7 +138,7 @@ drop user role4;
create table t2 select * from t1;
# no current role = error
--error ER_MALFORMED_DEFINER
--error ER_INVALID_ROLE
create definer=current_role trigger tr1 before insert on t2 for each row
insert t1 values (111, 222, 333);
@ -170,7 +170,7 @@ create definer=role3 trigger tr3 before update on t2 for each row
insert t1 values (111, 222, 333);
--replace_column 7 #
show create trigger tr3;
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
update t2 set b=2 where a=2;
select * from t1;
select * from t2;
@ -191,7 +191,7 @@ EOF
--replace_column 7 #
show create trigger tr2;
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
delete from t2 where a=2;
select * from t1;
select * from t2;
@ -201,7 +201,7 @@ select * from t2;
##################################################
# no current role = error
--error ER_MALFORMED_DEFINER
--error ER_INVALID_ROLE
create definer=current_role procedure pr1() insert t1 values (111, 222, 333);
# definer=current_role, but it has doesn't have enough privileges
@ -224,13 +224,13 @@ delete from t1 where a=111;
# definer=non_existent_role
create definer=role3 procedure pr3() insert t1 values (111, 222, 333);
show create procedure pr3;
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
call pr3();
select * from t1;
# change a procedure to use pre-10.0.5 definer with an empty hostname
update mysql.proc set definer='role2@' where definer='role2';
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
call pr2();
##################################################
@ -238,7 +238,7 @@ call pr2();
##################################################
# no current role = error
--error ER_MALFORMED_DEFINER
--error ER_INVALID_ROLE
create definer=current_role function fn1() returns int return (select sum(a+b) from t1);
# definer=current_role, but it has doesn't have enough privileges
@ -259,7 +259,7 @@ select fn2();
# definer=non_existent_role
create definer=role3 function fn3() returns int return (select sum(a+b) from t1);
show create function fn3;
--error ER_NO_SUCH_USER
--error ER_MALFORMED_DEFINER
select fn3();
##################################################
@ -269,7 +269,7 @@ select fn3();
set global event_scheduler=on;
# no current role = error
--error ER_MALFORMED_DEFINER
--error ER_INVALID_ROLE
create definer=current_role event e1 on schedule every 1 second starts '2000-01-01' do
insert t1 values (111, 1, 0);

View File

@ -1,10 +1,10 @@
select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
grant select on *.* to current_role;
ERROR 0L000: Invalid definer
ERROR OP000: Invalid role specification `NONE`
revoke select on *.* from current_role;
ERROR 0L000: Invalid definer
ERROR OP000: Invalid role specification `NONE`
revoke all, grant option from current_role;
ERROR 0L000: Invalid definer
ERROR OP000: Invalid role specification `NONE`
create role r1;
grant insert on test.* to r1;
grant r1 to current_user;

View File

@ -4,11 +4,11 @@
select priv into @root_priv from mysql.global_priv where user='root' and host='localhost';
--enable_cursor_protocol
--error ER_MALFORMED_DEFINER
--error ER_INVALID_ROLE
grant select on *.* to current_role;
--error ER_MALFORMED_DEFINER
--error ER_INVALID_ROLE
revoke select on *.* from current_role;
--error ER_MALFORMED_DEFINER
--error ER_INVALID_ROLE
revoke all, grant option from current_role;
create role r1;

View File

@ -38,20 +38,20 @@ sync_slave_with_master;
# End of 4.1 tests
connection master;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for rpl_do_grant@localhost;
connection slave;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for rpl_do_grant@localhost;
connection master;
create user rpl_do_grant@localhost;
show grants for rpl_do_grant@localhost;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for rpl_do_grant2@localhost;
sync_slave_with_master;
show grants for rpl_do_grant@localhost;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for rpl_do_grant2@localhost;
connection master;
@ -80,10 +80,10 @@ show grants for rpl_do_grant2@localhost;
connection master;
drop user rpl_do_grant2@localhost;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for rpl_do_grant2@localhost;
sync_slave_with_master;
--error 1141
--error ER_NONEXISTING_GRANT
show grants for rpl_do_grant2@localhost;
#####################################################
@ -151,7 +151,7 @@ DELETE FROM mysql.procs_priv;
FLUSH PRIVILEGES;
USE bug42217_db;
--echo "Can't execute the replicated routine on slave like before after procs privilege is deleted "
--error 1370
--error ER_PROCACCESS_DENIED_ERROR
SELECT upgrade_del_func();
--echo "Test the user who creates a function on master doesn't exist on slave."
@ -174,7 +174,7 @@ SHOW CREATE FUNCTION upgrade_alter_func;
--echo "Should no privilege record for upgrade_alter_func in mysql.procs_priv"
--replace_column 8 #
SELECT * FROM mysql.procs_priv;
--error 1449
--error ER_MALFORMED_DEFINER
SELECT upgrade_alter_func();
###### CLEAN UP SECTION ##############

View File

@ -7176,12 +7176,13 @@ ER_SP_CANT_SET_AUTOCOMMIT
geo "შენახული ფუნქციიდან და ტრიგერიდან ავტოკომიტის დაყენება დაშვებული არაა"
spa "No permitido usar auto acometida (autocommit) desde una función almacenada o disparador"
sw "Hairuhusiwi kuweka ahadi otomatiki kutoka kwa kitendaji iliyohifadhiwa au kichochezi"
ER_MALFORMED_DEFINER 0L000
chi "无效的定义"
eng "Invalid definer"
geo "არასწორი აღმწერი"
spa "Definidor inválido"
sw "Kibainisha batili"
ER_MALFORMED_DEFINER
chi "指定为定义的用户('%-.64s'@'%-.64s')不存在"
eng "The user specified as a definer ('%-.64s'@'%-.64s') does not exist"
ger "Der als Definierer angegebene Benutzer ('%-.64s'@'%-.64s') existiert nicht"
geo "('%-.64s'@'%-.64s')-ის აღმწერად მითითებული მომხმარებელი არ არსებობს"
spa "El usuario especificado como definidor ('%-.64s'@'%-.64s') no existe"
sw "Mtumiaji aliyebainishwa kama kibainishaji ('%-.64s'@'%-.64s') hayupo"
ER_VIEW_FRM_NO_USER
chi "VIEW'%-.192s'。'%-.192s'没有绝定的信息(旧表格式)。当前用户用作定义。请重新创建视图!"
eng "View '%-.192s'.'%-.192s' has no definer information (old table format). Current user is used as definer. Please recreate the view!"
@ -7194,8 +7195,8 @@ ER_UNUSED_30
sw "Hupaswi kuiona kamwe"
ER_NO_SUCH_USER
chi "指定为定义的用户('%-.64s'@'%-.64s')不存在"
eng "The user specified as a definer ('%-.64s'@'%-.64s') does not exist"
ger "Der als Definierer angegebene Benutzer ('%-.64s'@'%-.64s') existiert nicht"
eng "The user '%-.64s'@'%-.64s' does not exist"
ger "Der Benutzer '%-.64s'@'%-.64s' existiert nicht"
geo "('%-.64s'@'%-.64s')-ის აღმწერად მითითებული მომხმარებელი არ არსებობს"
spa "El usuario especificado como definidor ('%-.64s'@'%-.64s') no existe"
sw "Mtumiaji aliyebainishwa kama kibainishaji ('%-.64s'@'%-.64s') hayupo"
@ -8080,12 +8081,8 @@ ER_WRONG_PARTITION_NAME
spa "Nombre incorrecto de partición"
sw "Jina lisilo sahihi la kizigeu"
swe "Felaktigt partitionsnamn"
ER_CANT_CHANGE_TX_CHARACTERISTICS 25001
chi "交易正在进行,无法更改事务特性"
eng "Transaction characteristics can't be changed while a transaction is in progress"
geo "ტრანზაქციის მიმდინარეობისას მისი მახასიათებლების შეცვლა შეუძლებელია"
spa "No se pueden cambiar las característias de transacción mientras que una transacción se ecuentre en proceso"
sw "Sifa za muamala haziwezi kubadilishwa wakati shughuli inaendelea"
ER_CANT_SET_IN_TRANSACTION 25001
eng "%s can't be set while a transaction is in progress"
ER_DUP_ENTRY_AUTOINCREMENT_CASE
chi "ALTER TABLE表会导致AUTO_INCREMENT重建导致重复的条目'%-.192sT'用于索引'%-.192s'"
eng "ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '%-.192sT' for key '%-.192s'"

View File

@ -4960,7 +4960,7 @@ change_security_context(THD *thd,
{
if (acl_getroot(this, *definer_user, *definer_host, *definer_host, *db))
{
my_error(ER_NO_SUCH_USER, MYF(0), definer_user->str,
my_error(ER_MALFORMED_DEFINER, MYF(0), definer_user->str,
definer_host->str);
DBUG_RETURN(TRUE);
}

View File

@ -2854,7 +2854,7 @@ bool sp_process_definer(THD *thd)
if (!is_acl_user(lex->definer->host, lex->definer->user))
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_NO_SUCH_USER, ER_THD(thd, ER_NO_SUCH_USER),
ER_MALFORMED_DEFINER, ER_THD(thd, ER_MALFORMED_DEFINER),
lex->definer->user.str, lex->definer->host.str);
}
#endif /* NO_EMBEDDED_ACCESS_CHECKS */
@ -10001,7 +10001,7 @@ LEX_USER *create_default_definer(THD *thd, bool role)
if (role && definer->user.length == 0)
{
my_error(ER_MALFORMED_DEFINER, MYF(0));
my_error(ER_INVALID_ROLE, MYF(0), "NONE");
return 0;
}
else

View File

@ -4511,7 +4511,7 @@ static bool check_tx_isolation(sys_var *self, THD *thd, set_var *var)
if (var->type == OPT_DEFAULT && thd->in_active_multi_stmt_transaction())
{
DBUG_ASSERT(thd->in_multi_stmt_transaction_mode());
my_error(ER_CANT_CHANGE_TX_CHARACTERISTICS, MYF(0));
my_error(ER_CANT_SET_IN_TRANSACTION, MYF(0), "TRANSACTION ISOLATION");
return TRUE;
}
return FALSE;
@ -4542,7 +4542,9 @@ static bool check_tx_read_only(sys_var *self, THD *thd, set_var *var)
if (var->type == OPT_DEFAULT && thd->in_active_multi_stmt_transaction())
{
DBUG_ASSERT(thd->in_multi_stmt_transaction_mode());
my_error(ER_CANT_CHANGE_TX_CHARACTERISTICS, MYF(0));
my_error(ER_CANT_SET_IN_TRANSACTION, MYF(0),
var->save_result.ulonglong_value ? "TRANSACTION READ ONLY"
: "TRANSACTION READ WRITE");
return true;
}
return false;

View File

@ -6964,15 +6964,15 @@ bool TABLE_LIST::prepare_view_security_context(THD *thd, bool upgrade_check)
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS))
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_NO_SUCH_USER,
ER_THD(thd, ER_NO_SUCH_USER),
ER_MALFORMED_DEFINER,
ER_THD(thd, ER_MALFORMED_DEFINER),
definer.user.str, definer.host.str);
}
else
{
if (thd->security_ctx->master_access & PRIV_REVEAL_MISSING_DEFINER)
{
my_error(ER_NO_SUCH_USER, MYF(upgrade_check ? ME_WARNING: 0),
my_error(ER_MALFORMED_DEFINER, MYF(upgrade_check ? ME_WARNING: 0),
definer.user.str, definer.host.str);
}
else