Bug #11230 Keeping comments when storing stored procedures
Submitted: 10 Jun 2005 9:23 Modified: 21 Nov 2007 4:32
Reporter: Kai Sautter (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:5.0.6 OS:Any (all)
Assigned to: CPU Architecture:Any
Tags: Contribution
Triage: D5 (Feature request)

[10 Jun 2005 9:23] Kai Sautter
Description:
It would be helpful, if comments (lines starting "--") within the declaration of a stored procedure would be stored in the procedure. The same applies also for empty lines.

The below script results in a stred procedure that looks like this:

BEGIN
DECLARE var1 INT UNSIGNED;
<some routine>
END

Which is not very handy for maintenance.

How to repeat:
DELIMITER $$
CREATE PROCEDURE TEST1(INOUT param1 INT)
BEGIN

-- declaring variables
DECLARE var1 INT UNSIGNED;

-- preparing data
<some routine>

END$$

DELIMITER ;
[10 Jun 2005 11:34] Sergei Golubchik
This is mysql command line client issue.

Server itself stores whatever it is sent, but mysql client strips comments.

Workaround: try another client, e.g. MySQL Query Browser.
[2 Jul 2006 21:56] Marc Alff
Posted a proposed patch on the internals list.

http://lists.mysql.com/internals/33710

The patch allows comments for :
- functions
- stored procedures
- triggers
[18 Aug 2006 21:31] Marc Alff
Revised patch :

http://lists.mysql.com/internals/33718
[12 Oct 2006 5:11] Marc Alff
Signed and sent the CLA (Contribution License Agreement),
covering this contribution.
[1 Nov 2007 13:38] Marc Alff
See related bug#26215
[16 Nov 2007 9:30] Bugs System
Pushed into 5.0.52
[16 Nov 2007 9:32] Bugs System
Pushed into 5.1.23-rc
[16 Nov 2007 9:34] Bugs System
Pushed into 6.0.4-alpha
[21 Nov 2007 4:32] Paul Dubois
Noted in 5.0.52, 5.1.23, 6.0.4 changelogs.

mysql stripped comments from statements sent to the server. Now the
--comments or --skip-comments option can be used to control whether
to retain or strip comments. The default is --skip-comments.