Bug #25957 Invalid Single Line Comment syntax recognized in \. command
Submitted: 30 Jan 2007 23:47 Modified: 19 May 2009 17:26
Reporter: John Foelster Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0, 5.1, 4.1 OS:Windows (Windows XP Pro, Linux)
Assigned to: CPU Architecture:Any

[30 Jan 2007 23:47] John Foelster
Description:
Running saved batch scripts with the "\." Command will execute successfully if single line comments are included in the following format:

--This is not a comment

as opposed to the correct:

-- But this is

The Query Browser parser blocks the incorrect syntax correctly and this can cause some confusion if scripts are originally constructed for Command line interpretation are subsequently run via Query Browser.

How to repeat:
Running saved batch scripts with the "\." Command will execute successfully if single line comments are included in the following format:

--This is not a comment

as opposed to the correct:

-- But this is
[31 Jan 2007 8:47] Sveta Smirnova
Thank you for the report.

Verified as described on Linux using last BK sources. All versions are affected.
[19 May 2009 17:26] Jim Winstead
There is too much that relies on a leading '--' with no trailing space being treated as a comment by the mysql command-line client, so we won't change this default behavior. Using the --comments switch to mysql does cause all comments to be sent to the server, and it will barf on -- comments without a trailing space.
[19 May 2009 22:52] John Foelster
Might it then be permissible to consider that allowing the '--' comment syntax in query browser with a warning ought to be implemented?

I know consistency is the hobgoblin of small minds and all that, but still...

I've long since switched to Postgre for the project this bug report originated on for reasons of ease of db interactivity with a 3rd party db, so this is merely of academic interest, but still.

Better late than never, btw.
[27 Apr 2010 14:49] Karsten Wutzke
It's really a "duh" bug. I regularly meet developers who think that MySQL doesn't know single-line comments and use multi-line comments instead. It would really help to fix this nontheless.