LOAD DATA ESCAPED is not working like Mysql
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
```sql
"field1","field2"
"a""b","cd""ef"
"a"b",c"d"e
```
### 1. Minimal reproduce step (Required)
```sql
create table t1 (a varchar(20), b varchar(20));
load data local infile '~/pingcap/Github/tidb-test/MYSQL_TEST/std_data/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
select * from t1;
drop table t1;
```
### 2. What did you expect to see? (Required)
```sql
mysql> load data local infile '~/pingcap/Github/tidb-test/MYSQL_TEST/std_data/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
Query OK, 3 rows affected (0.01 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from t1;
+--------+--------+
| a | b |
+--------+--------+
| field1 | field2 |
| a"b | cd"ef |
| a"b | c"d"e |
+--------+--------+
3 rows in set (0.00 sec)
mysql> drop table t1;
Query OK, 0 rows affected (0.00 sec)
```
### 3. What did you see instead (Required)
```sql
mysql> create table t1 (a varchar(20), b varchar(20));
Query OK, 0 rows affected (0.11 sec)
mysql> load data local infile '~/pingcap/Github/tidb-test/MYSQL_TEST/std_data/loaddata_dq.dat' into table t1 fields terminated by ',' enclosed by '"' escaped by '"' (a,b);
Query OK, 3 rows affected (0.00 sec)
Records: 3 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from t1;
+--------+--------+
| a | b |
+--------+--------+
| field1 | field2 |
| | cdef |
| | cde |
+--------+--------+
3 rows in set (0.00 sec)
mysql> drop table t1;
Query OK, 0 rows affected (0.24 sec)
```
### 4. What is your TiDB version? (Required)
```sql
| Release Version: v5.4.0
Edition: Community
Git Commit Hash: 55f3b24c1c9f506bd652ef1d162283541e428872
Git Branch: heads/refs/tags/v5.4.0
UTC Build Time: 2022-01-25 08:41:05
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
```
Contributor guide
Assessment
This issue has not been assessed yet.