ID #1172

Nested C-style comments fail with MySQL 5.1

 

Nested comments written like /* external /* internal comment */ comment */ fail to execute with MySQL 5.1 and higher.  It works before that.

 That is a problem with 'stored programs' and Views. When dumping a Stored Procedure for instance SQLyog will (like 'mysqldump' and most other up-to-date programs) generate syntax like

DELIMITER $$

/*!50003 CREATE  PROCEDURE ´sp1´()
BEGIN
  /* a comment */
END */$$

DELIMITER ;

.. and you see the sequence /*! .. /* .. */ .. */ what fails to restore in some early 5.1 servers (but works with server versions before 5.1). Also some versions of (the discontinued) MySQL 6.0 have this problem. MySQL 5.5.x is not affected.

MySQL has confirmed this to be a server bug with specific 5.1 servers.  The bug was fixed in MySQL 5.1.35 and onwards.

Related MySQl bug reports: http://bugs.mysql.com/bug.php?id=39559 and http://bugs.mysql.com/bug.php?id=44189 and http://bugs.mysql.com/bug.php?id=30631

As SQLyog will use the same comment construction internally in 'copy database' it also affects here.

Workaround: If you have an affected server version and for some reason do not want to or cannot upgrade the server you may use "-- comment" or "#comment" but not "/*comment*/" inside stored programs and Views.

 

Categories for this entry

Tags: -

Related entries:

You can comment this FAQ