Bug #19555 Cannot insert text which includes escaped quote and semi-colon
Submitted: 5 May 2006 1:20 Modified: 29 Nov 2006 10:10
Reporter: Rob Worsnop Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.1.20 OS:Windows (Windows 2000)
Assigned to: Mike Lischke CPU Architecture:Any
Tags: Source Editors

[5 May 2006 1:20] Rob Worsnop
Description:
Inserting a text value that contains an escaped quote and a semi-colon causes a syntax error (1064).

How to repeat:
Run the following script, either on the command line or in Query Browser:

DROP TABLE IF EXISTS testbug;
CREATE TABLE testbug (description text);
INSERT INTO testbug (description) VALUES ('a\'b;c');

I would expect this to insert the following into the table:

a'b;c

Instead I see a syntax error.
[5 May 2006 6:21] Hartmut Holzgraefe
can't reproduce on Linux, what are your sql_mode settings?

SHOW VARIABLES LIKE 'sql_mode';
[5 May 2006 12:07] Rob Worsnop
My settings are:
'STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
[5 May 2006 12:53] Rob Worsnop
CORRECTION!
I do apologize. This behavior is not reproducible on the command line. It is only happening when the script is run in Query Browser. I have changed the severity accordingly.
I had reproduced it against a Linux server, but using Query Browser. Somehow I remembered this as running on the command line. (It was late.)
[5 May 2006 12:58] Rob Worsnop
BTW, the version of Query Browser is 1.1.20
[6 May 2006 1:17] MySQL Verification Team
Thank you for the bug report. This isn't a server bug instead it is
Query Browser's bug which not handles that query like the command
line does:

c:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7 to server version: 5.0.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> INSERT INTO testbug (description) VALUES ('a\'b;c');
Query OK, 1 row affected (0.05 sec)

mysql>
[12 Jun 2006 15:50] Bradley Perkins
I ran into this bug today. In my case I had used mysqldump to export a table from an older 3.23.58 database into a 5.0.22-max database. Any exported text column which contains an escaped quote generates a syntax error. In my case there are no semi-colons except at the end of the SQL statement.

Version 1.1.20 on Windows XP.
[29 Nov 2006 10:10] Mike Lischke
Thank you for your bug report. This issue has already been fixed in the latest released version of that product, which you can download at

  http://www.mysql.com/downloads/