Bug #10412 Client hangs with NO_BACKSLASH_ESCAPES
Submitted: 6 May 2005 13:14 Modified: 30 May 2005 11:31
Reporter: Hakan Küçükyılmaz Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0.6 (bk) OS:Linux (SuSE 9.3)
Assigned to: Magnus Blåudd CPU Architecture:Any

[6 May 2005 13:14] Hakan Küçükyılmaz
Description:
MySQL client hangs after INSERT.

How to repeat:
[15:13] root@test>SET sql_mode=NO_BACKSLASH_ESCAPES;
Query OK, 0 rows affected (0.00 sec)

5.0.6-beta-log
[15:13] root@test>USE test
Database changed
5.0.6-beta-log
[15:13] root@test>CREATE TABLE t1 (a char(5));
Query OK, 0 rows affected (0.19 sec)

5.0.6-beta-log
[15:13] root@test>INSERT INTO t1 VALUES('\');';
Query OK, 1 row affected (0.00 sec)

                              

Note: it does not return to the prompt anymore.
[30 May 2005 10:12] Magnus Blåudd
Tested with mysql 5.0.7 on Fedora Core 3
The INSERT query is not legal when \ is not an escape character anymore, it has been turned OFF using "set sql_mode=NO_BACKSLASH_ESCAPES". Thus the second ' will be treated as the terminator of the string. There is alos a closing parenteses missing in the INSERT. So if you correct the statement by removing the ' and adding a closing parentes, the statement will insert the string "\);" into t1. 

mysql> INSERT INTO t1 VALUES('\);');
Query OK, 1 row affected (0.00 sec)

mysql> select * from t1;
+------+
| a    |
+------+
| \);  |
+------+
1 row in set (0.01 sec)

Also note that when I run the faulty query the mysql client returns to the prompt and prints the proper error message. See below.

mysql> INSERT INTO t1 VALUES('\');';
Query OK, 1 row affected (0.01 sec)

ERROR 1064 (42000): 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 ''' at line 1
[30 May 2005 11:31] Sergei Golubchik
As Magnus demonstrated, it's not repeatable anymore:

mysql> INSERT INTO t1 VALUES('\');';
Query OK, 1 row affected (0.01 sec)
                                                                                    
ERROR 1064 (42000): 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 ''' at line 1