Bug #44189 comment problem (again)
Submitted: 9 Apr 2009 15:05 Modified: 9 Apr 2009 15:17
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.33 OS:Any
Assigned to:
Tags: qc

[9 Apr 2009 15:05] Peter Laursen
Description:
I am crating a new report with reference to 
http://bugs.mysql.com/bug.php?id=30631

The 'solution' was to document that comments cannot be nested. This is not safisfactory! I reported a difference in behaviour between 5.0 and 5.1.  The 5.0 behaviour is preferable!

5.1 implementation results in a serious risk that dumps will not restore 'stored programs'!

How to repeat:
DELIMITER $$

CREATE PROCEDURE `spdumptest`.`sp1`()
    
    BEGIN		
                -- a comment    
    END$$

CREATE PROCEDURE `spdumptest`.`sp2`()
    BEGIN
		#a comment
    END$$

CREATE PROCEDURE `spdumptest`.`sp3`()
    BEGIN
		/* a comment */
    END$$

DELIMITER ;

.. now DUMP the database.  Most programs including mysqldump will generate SQL for sp3 like 

/*!50003 CREATE DEFINER=`root`@`localhost` PROCEDURE `sp3`()
BEGIN
		/* a comment */
END */$$

This fails to restore in 5.1.33 but restores perfectly in 5.0.77!

Suggested fix:
1) It is obviously wrong that comments cannot be nested.  They can at least like this

/*
comment
-- comment
*/

.. so at least docs should be corrected. *sometimes* comments can be nested!

2) As backup tools will use "conditional comments" it is not safe to use /*this comment style*/ inside stored programs (including Views), as they will fail to restore from backup created wwith msot backup tools.  This should be made much more clear in documentation!

3) preferred: restore the 5.0 behaviour to later versions!
[9 Apr 2009 15:11] Davi Arnaut
Duplicate of Bug#39559 ?
[9 Apr 2009 15:17] Valerii Kravchuk
Duplicate of bug #39559.