Bug #18078 Defining event commands greedily consumes beyond delimiter
Submitted: 8 Mar 2006 17:01 Modified: 4 May 2006 3:09
Reporter: Chad MILLER
Status: Closed
Category:Server: SP Severity:S3 (Non-critical)
Version:5.1 OS:Linux (Suse Linux)
Assigned to: Bugs System Target Version:

[8 Mar 2006 17: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 19:20] Miguel Solorzano
Thank you for the bug report.
[8 Mar 2006 20: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 3: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.
[11 Mar 2006 0: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
[11 Mar 2006 0: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 18:08] Chad MILLER
First reviewed by Andrey Hristov.
[14 Mar 2006 10: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 12:15] Magnus Blaudd
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 3:15] Brian Aker
We now have the mysqldump test disabled for this bug, so we need to resolve it.
[3 May 2006 4: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 15: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 20:11] Chad MILLER
Applied to 5.1.10-beta .
[4 May 2006 3: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.