Bug #31539 ALTER EVENT RENAME TO... resets STATUS to 'ENAMLE'
Submitted: 11 Oct 2007 15:59 Modified: 11 Dec 2007 20:13
Reporter: Omer Barnir (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S2 (Serious)
Version:5.1.22 OS:Any
Assigned to: Damien Katz CPU Architecture:Any

[11 Oct 2007 15:59] Omer Barnir
Description:
The ALTER EVENT COMMAND should maintains the value of properties not changed in the ALTER comand. (see: http://dev.mysql.com/doc/refman/5.1/en/alter-event.html).

However renaming an event, resets its status to ENABLE.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.22-rc-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> create table tb (i int);
Query OK, 0 rows affected (0.03 sec)

mysql> CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO insert into tb1 values (1);
Query OK, 0 rows affected (0.01 sec)

mysql> select status from mysql.event where name='ev1';
+--------------------+
| status             |
+--------------------+
| SLAVESIDE_DISABLED |
+--------------------+
1 row in set (0.00 sec)

mysql> ALTER EVENT ev1 RENAME TO ev2;
Query OK, 0 rows affected (0.00 sec)

mysql> select status from mysql.event where name='ev2';
+---------+
| status  |
+---------+
| ENABLED |
+---------+
1 row in set (0.00 sec)

mysql>                                              

How to repeat:
1) Start a mysql server
2) Login using the 'mysql' client
3) Run the following sqlmysql> 
USE test;
CREATE TABLE tb (i INT);
CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE 
  DO insert into tb1 values (1);
ALTER EVENT ev1 RENAME TO ev2;

Suggested fix:
Status of the event should not change by the ALTER command unless specifically specified.
[18 Oct 2007 23:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35877

ChangeSet@1.2589, 2007-10-18 19:51:30-04:00, dkatz@damien-katzs-computer.local +6 -0
  Bug#31539 ALTER EVENT RENAME TO... resets STATUS to 'ENABLED
  Bug#27407 Events: altering changes 'on completion preserve'
  
  To fix bugs with "alter events", added "changed" flags to Event_parse_data, so we can tell if a completion or status value has been explicitly stated in the SQL, or if it's the default settings.
[14 Nov 2007 21:21] Damien Katz
queued to 5.1-runtime
[6 Dec 2007 11:12] Konstantin Osipov
Pushed into 5.1.23
[11 Dec 2007 20:13] Paul DuBois
Noted in 5.1.23 changelog.

Using ALTER EVENT to rename a disabled event caused it to become enabled.