Bug #20319 Events not migrated when user is renamed with RENAME USER
Submitted: 7 Jun 2006 15:48 Modified: 2 Feb 2007 9:49
Reporter: Andrey Hristov Email Updates:
Status: Closed
Category:Server: Docs Severity:S3 (Non-critical)
Version:5.1.11 OS:Any (all)
Assigned to: Jon Stephens Target Version:
Triage: D4 (Minor)

[7 Jun 2006 15:48] Andrey Hristov
Description:
CREATE USER xyz@localhost;
GRANT EVENT on db1.* TO xyz@localhost;

mysql -u xyz -p db1
CREATE EVENT xyz_event1 ON SCHEDULE EVERY 1 HOUR DISABLE DO SELECT 42;

mysql -u root -p
RENAME USER xyz@localhost TO abc@localhost;
SELECT * FROM INFORMATION_SCHEMA.EVENTS\G 

How to repeat:
See above
[9 Jun 2006 11:09] Konstantin Osipov
Andrey, I don't think it's a bug. Events do not belong to a USER any  more, they belong to
the schema. 
But you raised an important question in this report: what shall happen to events when
EVENT privilege is revoked? I believe nothing, as EVENT only grants access to CREATE/DROP
EVENT only, and already created events reuse other user's privileges during execution.
I will check this with Dmitri.
[26 Jan 2007 13:12] Konstantin Osipov
Hello Andrey, I believe this is not a bug and needs a clarification in documentation.
In MySQL RENAME USER is semantically equivalent to DROP USER and CREATE USER. 
DROP USER does not automatically invalidate objects that the user created - there is no
concept of ownership in MySQL privilege system. This behavior affects views, stored
procedures, triggers, and events.
[2 Feb 2007 9:49] Jon Stephens
Thank you for your bug report. This issue has been addressed in the documentation. The
updated documentation will appear on our website shortly, and will be included in the
next release of the relevant products.

Updated Events and Privileges discussion in 5.1 Manual; ađed note to DROP USER, RENAME
USER discussion in 5.0 and 5.1 Manual.