Bug #17565 RENAME DATABASE destroys events
Submitted: 20 Feb 2006 3:01 Modified: 23 Oct 2007 17:59
Reporter: Markus Popp Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S2 (Serious)
Version:5.1.8BK OS:Linux (SuSE Linux 10.0)
Assigned to: Marc ALFF CPU Architecture:Any
Tags: rt_q1_2007

[20 Feb 2006 3:01] Markus Popp
Description:
A RENAME DATABASE command destroys all events in the renamed database.

How to repeat:
mysql> show events from test\G
*************************** 1. row ***************************
            Db: test
          Name: insertIntoTT
       Definer: mpopp@%
          Type: RECURRING
    Execute at: NULL
Interval value: 5
Interval field: SECOND
        Starts: 2006-02-20 02:57:41
          Ends: 0000-00-00 00:00:00
        Status: ENABLED
1 row in set (0.00 sec)

mysql> rename database test to test2;
Query OK, 0 rows affected (0.00 sec)

mysql> show events from test2\G
Empty set (0.01 sec)

mysql>
[20 Feb 2006 9:37] Andrey Hristov
Currently not priority 1 because for the moment RENAME DATABASE is used for data migration from 5.0 to 5.1 . In the latter there is new file name encoding scheme.
[5 Sep 2007 9:58] Konstantin Osipov
Will be fixed by WL#4030 "Deprecate RENAME DATABASE: replace with ALTER DATABASE <name> UPGRADE"
[19 Oct 2007 19:20] Marc ALFF
Pushed into 5.1.23-beta
[23 Oct 2007 17:59] Paul DuBois
Noted in 5.1.23 changelog.

The RENAME DATABASE statement was removed and replaced with ALTER
DATABASE db_name UPGRADE DATA DIRECTORY NAME. The RENAME DATABASE
statement was intended for upgrading database directory names to the
encoding format used in 5.1 for representing identifiers in the
filesystem. However, the statement was found to be dangerous
because it could result in loss of database contents.