pingcap / pingcap/tidb

LOAD DATA ESCAPED is not working like Mysql

Open
#33,247 0 comments 0 reactions 0 assignees View on GitHub
affects-5.4 affects-6.1 affects-6.2 may-affects-4.0 may-affects-5.0 may-affects-5.1 may-affects-5.2 may-affects-5.3 may-affects-6.0 sig/transaction type/feature-request
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.