Bug #14032 Comment with space requirement '-- ' is not standard SQL 92
Submitted: 14 Oct 2005 15:58 Modified: 15 Dec 2010 11:18
Reporter: Jari Aalto Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: General Severity:S4 (Feature request)
Version:5.x OS:Any (Any)
Assigned to: CPU Architecture:Any

[14 Oct 2005 15:58] Jari Aalto
Description:
Porting SQL statements from other implementation to MySQL conflicts with
Non-standard handling of SQL 92 comments that are deifned[1] as:

   5.2 <token> and <separator>
         ...
         <comment> ::=
              <comment introducer> [ <comment character>... ] <newline>

         <comment character> ::=
                <nonquote character>
              | <quote>

         <comment introducer> ::= <minus sign><minus sign>[<minus sign>...]

         <newline> ::= !! implementation-defined end-of-line indicator

How to repeat:
"-- " comment requirement with required SPACE is not standard SQL.

Suggested fix:
the --ansi mode should enforce strict SQL 92, in terms of comments as well.

The manual of 5.x also incorrectly states that "Some other SQL databases use", whereas it should read that this is the standard compliant manner of writing comments into the SQL files. Please rephrase the manual as well.

    `--' as the Start of a Comment
    ..............................

    Some other SQL databases use `--' to start comments.  MySQL Server uses
    `#' as the start comment character. You can also use the C comment
    style `/* this is a comment */' with MySQL Server.  *Note Comments::.

    MySQL Server 3.23.3 and above support the `--' comment style, provided
    the comment is followed by a space (or by a control character such as a
    newline) ... [2]

[1] The SQL 92 is downloadable at:
http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt

[2] The text exerpt is from manaual 5.0.1-alpha
[23 Aug 2011 1:41] Dimitriy A
It seemed like it was working in MySQL 5.0, but broken again in MySQL 5.5? I have tested in MySQL 5.0.44sp1 and MySQL 5.5.13.