Bug #35461 Not able to insert '\' character.
Submitted: 20 Mar 2008 15:19 Modified: 20 Mar 2008 15:32
Reporter: Hema Sridharan Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:mysql-6.0-backup OS:Linux
Assigned to: CPU Architecture:Any

[20 Mar 2008 15:19] Hema Sridharan
Description:
1) I create database and tables in database
2) I insert some characters in table.
3) All characters except '\' is accepted and for '\' character command errors out.
4) When I try to load the character by using load data infile command, the character disappears and also affects the next entry. 

How to repeat:
mysql> create database db;
Query OK, 1 row affected (0.00 sec)

mysql> use db;
Database changed
mysql> create table t1(a char(4))engine=myisam;
Query OK, 0 rows affected (0.05 sec)

mysql> insert into t1 values('*'),('%'),('^');
Query OK, 3 rows affected (0.00 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> select * from t1;
+------+
| a    |
+------+
| *    |
| %    |
| ^    |
+------+
3 rows in set (0.00 sec)

mysql> insert into t1 values ('\');
    '> ;
    '> ';
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

INSERTING VALUES IN TABLE BY USING LOAD DATA INFILE
===================================================

mysql> create table t2(a char(4));
Query OK, 0 rows affected (0.03 sec)

mysql> load data local infile '/tmp/charset.txt' into table t2;
Query OK, 2 rows affected (0.00 sec)
Records: 2  Deleted: 0  Skipped: 0  Warnings: 0

I loaded 3 rows($,\, *) in the text file, but while using load data infile , only 2 rows got affected and by using select we can notice that '\' is missing and it also affected the immediate next character '*'.

mysql> select * from t2;
+------+
| a    |
+------+
| $    |
|
*   |
+------+
2 rows in set (0.00 sec)
[20 Mar 2008 15:32] Valeriy Kravchuk
Sorry, but this is not a bug. Look:

mysql> select version();
+-----------------------+
| version()             |
+-----------------------+
| 6.0.4-alpha-community |
+-----------------------+
1 row in set (0.00 sec)

mysql> drop table t1;
Query OK, 0 rows affected (0.56 sec)

mysql> create table t1(a char(4))engine=myisam;
Query OK, 0 rows affected (0.20 sec)

mysql> insert into t1 values('*'),('%'),('^');
Query OK, 3 rows affected (0.06 sec)
Records: 3  Duplicates: 0  Warnings: 0

mysql> insert into t1 values ('\\');
Query OK, 1 row affected (0.00 sec)

mysql> select * from t1;
+------+
| a    |
+------+
| *    |
| %    |
| ^    |
| \    |
+------+
4 rows in set (0.05 sec)

Please, read the manual, http://dev.mysql.com/doc/refman/5.0/en/string-syntax.html.
[26 May 2015 12:49] zishan paya
Link is not working.
In 6.2 '\' character is combining two cell when loading CSV file.