Bug #52941 Mysql Workbench SQL editor doesn't support version specific comments
Submitted: 19 Apr 2010 11:12 Modified: 2 Aug 2010 11:12
Reporter: Rob Kings Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S4 (Feature request)
Version:5.1 OS:Any
Assigned to: Tony Bedford CPU Architecture:Any
Tags: comment, SQL, workbench

[19 Apr 2010 11:12] Rob Kings
Description:
I've used a suggestion from "High Performance mySQL" (A top book by the way!) that has allowed me to put comments into stored-procedures and persist them during a backup-restore operation.

e.g. The format is

/*!99999 Since Version 9.9.999 will never exist
* this will always remain a comment
*/

It works fine with Querybrowser/Administrator but is Workbench I cannot edit a procedure that contains one of these version-specific comments.

How to repeat:
Create an SP in Query browser with a version specific comment in the form

/*! 99999 This is my comment */

attempt to edit in Workbench
[19 Apr 2010 13:46] Valeriy Kravchuk
Indeed, looks like Workbench has problems with comments, at least for some versions that do not correspond to server version. All these works in command line (although comments are removed):

77-52-4-109:trunk openxs$ bin/mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.5-m3-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> create procedure proc2() begin select 1; /*!55555 my comment */ end;//
Query OK, 0 rows affected (0.00 sec)

mysql> create procedure proc3() begin select 1; /*!99999 my comment */ end;//
Query OK, 0 rows affected (0.00 sec)

but in WB 5.2.19 one has to add these comments manually in SQL window when applying changes, and they still are NOT stored.
[12 May 2010 17:40] Sergei Tkachenko
In the past SQL parser was set to uncomment version specific comments to enable processing of mysqldump scripts. But that also appeared to be the cause of this bug, because SQL parser is involved when generating create/alter script (comment contents appears uncommented in alter script). Now parser changed to restore original SQL once after parsing and before any further processing which makes WB generate proper alter script.
[25 Jun 2010 7:11] Susanne Ebrecht
This is not a bug at all.

The comment syntax just described applies to how the mysqld server parses SQL
statements.

These comments are client responsibilities and not server responsibilities.

For example client tool mysqldump at server version so that on restore into another
server version the server parser knows how to parse statements correct.

There is no need for the server to store these comments.

I will set this bug to documentation bug because it could get better documented.
[2 Aug 2010 11:12] Tony Bedford
Fixed in XML sources. Have added a note to http://dev.mysql.com/doc/refman/X.Y/en/comments.html:

      Comments in this format, <literal>/*!12345 ... */</literal>, are
      not stored on the server. If this format is used to comment stored
      routines, the comments will not be retained on the server.