Bug #539 Quotes in comments make script fail silently (in cases)
Submitted: 29 May 2003 14:44 Modified: 15 Jul 2003 4:28
Reporter: Karsten Wutzke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S1 (Critical)
Version:4.1 alpha OS:Windows (Windows 2000)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[29 May 2003 14:44] Karsten Wutzke
Description:
Using a unequal number of single or double quotes inside a mulit-line comment (/**/) can make an SQL script not run through. Sometimes the script simply runs through silently, so one may think everthing was OK. Some other times, unpredictable error messages occur, depending on the rest of the code that is truncated.

Note:

1. You can also put in three quotes, five, seven, ... etc. it stays the same.
2. Putting an equal number of quotes does not seem to do harm, as long as it stays in the same comment.

How to repeat:
INSERT INTO GameStat VALUES ( 110, 55, 4,  81);
INSERT INTO GameStat VALUES ( 111, 55, 6,  75);
INSERT INTO GameStat VALUES ( 112, 56, 0,  68);
INSERT INTO GameStat VALUES ( 113, 56, 8,  89);

/* TV Dieburg GameStat ID's (4), 9, 20, 25, 30, 43, 44, (59), 62 */
                         ^
                         |
                       UH-OH!

from here the rest of the script is not executed!!! I wondered where the data had gone when I reran the script one day - I seem to have put in some '''''...

/* Ginsheim                                   J  S  F */
INSERT INTO PlayerStat VALUES (  0,   9,  0, 10, 1, 2); /* Karsten */
INSERT INTO PlayerStat VALUES (  1,   9,  1, 14, 1, 3); /* Johannes */
INSERT INTO PlayerStat VALUES (  2,   9,  2,  6, 0, 3); /* Ahmed */
INSERT INTO PlayerStat VALUES (  3,   9,  4, 13, 1, 5); /* Daniel */
INSERT INTO PlayerStat VALUES (  4,   9,  6,  7, 0, 0); /* Michael K. */
INSERT INTO PlayerStat VALUES (  5,   9,  7, 15, 1, 2); /* Patrick */
INSERT INTO PlayerStat VALUES (  6,   9,  8,  5, 0, 0); /* Joann */
INSERT INTO PlayerStat VALUES (  7,   9,  9,  8, 1, 2); /* Michael W. */

.
.
.

lots more omitted without notice

Suggested fix:
Well, simply avoid all kinds of quotes and other non-standard characters in comments!
[30 May 2003 5:21] Alexander Keremidarski
Same happens with double quotes and backticks. 
'' "" ``

Each of them must be balanced in whole query string not single comment.
[15 Jul 2003 4:28] Ramil Kalimullin
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html