Bug #52844 semi-colon following MySQL comment fails to parse inside of CREATE PROCEDURE
Submitted: 15 Apr 2010 1:00 Modified: 15 Apr 2010 3:29
Reporter: Bishop B Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:5.0.60-log, 5.0.91, 5.1.47 OS:Any (Linux, Mac OS X)
Assigned to: CPU Architecture:Any

[15 Apr 2010 1:00] Bishop B
Description:
When creating a procedure, it seems you cannot place a semi-colon outside of a MySQL conditional comment.  However, you can do so outside of a procedure creation.

Conversely, you cannot place a semi-colon inside a conditional comment when outside a create procedure, but you can when inside.

How to repeat:
-- this parses (note placement of semi-colon)
/*!  DROP VIEW IF EXISTS `BuildingNames` */;

DELIMITER //
CREATE PROCEDURE doDelta100()
BEGIN
    -- this does not parse (again, see semi-colon)
    /*! DROP VIEW IF EXISTS `BuildingNames` */;
END //
DELIMITER ;

-- but compare to:

-- this does not parse
/*!  DROP VIEW IF EXISTS `BuildingNames`; */

DELIMITER //
CREATE PROCEDURE doDelta100()
BEGIN
    -- but this does parse
    /*! DROP VIEW IF EXISTS `BuildingNames`; */
END //
DELIMITER ;

Suggested fix:
Place the semi-colon INSIDE the conditional comment when INSIDE a begin ... end.
Place the semi-colon OUTSIDE the conditional comment when OUTSIDE a begin ... end.
[15 Apr 2010 3:29] Valeriy Kravchuk
Thank you for the problem report. Verified just as described with recent 5.0.91 from bzr on Linux:

77-52-4-109:5.0 openxs$ bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.91-debug Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> /*!  DROP VIEW IF EXISTS `BuildingNames` */;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> delimiter //
mysql> CREATE PROCEDURE doDelta100()
    -> BEGIN
    ->     -- this does not parse (again, see semi-colon)
    ->     /*! DROP VIEW IF EXISTS `BuildingNames` */;
    -> END //
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 5
mysql> delimiter ;
mysql> /*!  DROP VIEW IF EXISTS `BuildingNames`; */
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
    -> 
    -> ;
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> CREATE PROCEDURE doDelta100()
    -> BEGIN
    ->     -- but this does parse
    ->     /*! DROP VIEW IF EXISTS `BuildingNames`; */
    -> END //
Query OK, 0 rows affected (0.02 sec)

On 5.1.47 first procedure parses OK though:

77-52-4-109:5.1 openxs$ bin/mysql -uroot testReading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.47-debug Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> /*!  DROP VIEW IF EXISTS `BuildingNames` */;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> delimiter //
mysql> CREATE PROCEDURE doDelta100()
    -> BEGIN
    ->     -- this does not parse (again, see semi-colon)
    ->     /*! DROP VIEW IF EXISTS `BuildingNames` */;
    -> END //
Query OK, 0 rows affected (0.01 sec)

But second one also parses, unlike that DROP VIEW in the command line.
[4 Feb 2012 18:41] CronLorsmus CronLorsmus
Anypsussy <a href=http://napechke.com>Anrielelin</a> Phabupbum http://napechke.com - Senanamaso Ulcerurnede http://napechke.com