Bug #18078 Defining event commands greedily consumes beyond delimiter
Submitted: 8 Mar 2006 16:01 Modified: 4 May 2006 1:09
Reporter: Chad MILLER Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.1 OS:Linux (Suse Linux)
Assigned to: Chad MILLER CPU Architecture:Any

[8 Mar 2006 16:01] Chad MILLER
Description:
mysql> /*!50106 CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 */;
Query OK, 1 row affected (0.01 sec)

mysql> show create event ee1;
+-------+----------+----------------------------------------------------------------------------------------------------------+
| Event | sql_mode | Create Event                                                                                             |
+-------+----------+----------------------------------------------------------------------------------------------------------+
| ee1   |          | CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 17:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 */ |
+-------+----------+----------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

### note the "*/".  It requires a delimiter.

mysql> /*!50106 CREATE EVENT `ee2` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5; */;
Query OK, 1 row affected (0.00 sec)

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*/' at line 1

mysql> delimiter ;;

mysql> /*!50106 CREATE EVENT `ee2` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5; */;;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'set @a=5; */' at line 1

mysql> show create event ee2;
+-------+----------+-------------------------------------------------------------------------------------------------------+
| Event | sql_mode | Create Event                                                                                          |
+-------+----------+-------------------------------------------------------------------------------------------------------+
| ee2   |          | CREATE EVENT `ee2` ON SCHEDULE AT '2035-12-31 17:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 |
+-------+----------+-------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

How to repeat:
delimiter ;;
/*!50106 CREATE EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5; */;;
/*!50106 CREATE EVENT `ee2` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5;; */;;
/*!50106 CREATE EVENT `ee3` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 */;;  # wrong, but doesn't complain.
show create event ee3;
[8 Mar 2006 18:20] MySQL Verification Team
Thank you for the bug report.
[8 Mar 2006 19:09] Chad MILLER
Since this blocks my #16853 bug, I'm going to try to fix it so that we can get 5.1.8 cloned.  I hope to have something today.

Setting to P2, to match the bug it blocks.
[9 Mar 2006 2:29] Chad MILLER
I gave the bug a try, but I can't find the problem and I'm a bit new to the code to intuit where to look.  

Earlier today, Andrey Hristov said he'd start on it this evening if I didn't have a fix by now.
[10 Mar 2006 23:16] 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/3731
[10 Mar 2006 23:24] 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/3732
[13 Mar 2006 17:08] Chad MILLER
First reviewed by Andrey Hristov.
[14 Mar 2006 9:04] 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/3812
[14 Mar 2006 11:15] Magnus BlÄudd
Not so long ago I fixed a similar bug where the parser could not "read back" sp with enclosed comments. So maybe it wouldn't be that hard to fix.
[30 Apr 2006 1:15] Brian Aker
We now have the mysqldump test disabled for this bug, so we need to resolve it.
[3 May 2006 2:52] 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/5840
[3 May 2006 13:55] 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/5890
[3 May 2006 18:11] Chad MILLER
Applied to 5.1.10-beta .
[4 May 2006 1:09] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented bugfix in 5.1.10 changelog; closed.