Bug #36211 mysql client rejects "--" comments that server accepts
Submitted: 18 Apr 2008 22:09
Reporter: Todd Farmer (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.56 OS:Any
Assigned to: CPU Architecture:Any
Tags: regression
Triage: Triaged: D3 (Medium)

[18 Apr 2008 22:09] Todd Farmer
Description:
MySQL supports a comment syntax for full-line comments starting with "--".  Unlike standard SQL, MySQL requires the second dash "to be followed by at least one whitespace or control character."  This is not enforced by the server, however, and until recently, was not enforced by the mysql command-line client, either.  This is no longer the case:

E:\>mysql-enterprise-gpl-5.0.56sp1-win32\bin\mysql.exe -uroot -P3310 < 25139.sql

VERSION()
5.0.56sp1-enterprise-gpl-nt-log
ERROR 1064 (42000) at line 4: 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 '-------------------------------------

SELECT NOW()' at line 1

E:\>mysql-enterprise-gpl-5.0.44sp1-win32\bin\mysql.exe -uroot -P3310 < 25139.sql

VERSION()
5.0.56sp1-enterprise-gpl-nt-log
NOW()
2008-04-19 09:47:01
@@sql_mode

How to repeat:
Execute following against 5.0.56sp1 using 5.0.56sp1 and 5.0.44sp1 clients:

SELECT VERSION();

-------------------------------------
-- Testing comments parsing
SELECT NOW();
SELECT @@sql_mode;

Note that using --comments or --skip-comments options has no impact on result.

Suggested fix:
The server and client should be consistent.  While the documentation on comment syntax is clear that the client's edits are more comprehensive than those on the server, modifying server behavior at this point in a GA release is not appropriate.  Please scale back the new comment edit checks in the client to match those on the server.