Description:
Creating this report as a generalization of https://bugs.mysql.com/bug.php?id=56353
## ISSUE
Error 1449 reads:
"ERROR 1449 (HY000): The user specified as a definer ('?'@'?') does not exist"
The message is misleading and confusing in case of objects that depend on other objects. For example:
- When you create a VIEW with correct definer, but that view depends on another VIEW with a broken definer (as in Bug #56353)
- When you invoke a procedure with a correct definer, but the procedure calls a function that has a broken definer.
In these and other similar cases, the error message does not indicate which stored object has an incorrect definer. The 2nd case (a complex stored procedure that used UDFs with broken definers) just cost me a couple hours of troubleshooting and I had to GDB through the procedure execution before I realized what was happening.
How to repeat:
## Example case 1
See https://bugs.mysql.com/bug.php?id=56353
## Example case 2
CREATE SCHEMA schema1;
GRANT EXECUTE, CREATE ROUTINE, ALTER ROUTINE ON schema1.* TO user1@'%';
(reconnect as user1)
DELIMITER //
CREATE PROCEDURE schema1.proc1 ()
BEGIN
SELECT schema1.func1();
END
//
DELIMITER ;
CREATE FUNCTION schema1.func1 () RETURNS CHAR(32)
RETURN MD5(UNIX_TIMESTAMP());
(reconnect as super user)
DROP USER user1@'%';
CALL schema1.proc1;
"ERROR 1449 (HY000): The user specified as a definer ('user1'@'%') does not exist"
Now imagine you have hundreds of users, tens of thousands of SPs and each is a couple thousand lines long...
Suggested fix:
Provide object name in the error message.
Minimum viable option:
"ERROR 1449 (HY000): The user specified as a definer (<user>) for <object_name> does not exist"
Better yet:
"ERROR 1449 (HY000): The user specified as a definer (<user>) for <object type> <object_name> does not exist"