Skip to content

Column list does not work in load data statement #35198

@jackysp

Description

@jackysp

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t66 (id int primary key,k int,c varchar(10),dt date,vv char(1),ts datetime);
LOAD DATA LOCAL INFILE '1.csv' INTO TABLE t66 FIELDS TERMINATED BY ',' ENCLOSED BY '\"' IGNORE 1 LINES (k,id,c,dt,vv,ts);
select * from t66;

The 1.csv is,

dsadasdas
"1","1",,"2022-04-19","a","2022-04-19 00:00:01"
"1","2","a","2022-04-19","a","2022-04-19 00:00:01"
"1","3","a","2022-04-19","a","2022-04-19 00:00:01"
"1","4","a","2022-04-19","a","2022-04-19 00:00:01"

2. What did you expect to see? (Required)

  1. Load data statement should not report warnings;
  2. Should get the results
mysql> select * from t66;
+----+------+------+------------+------+---------------------+
| id | k    | c    | dt         | vv   | ts                  |
+----+------+------+------------+------+---------------------+
|  1 |    1 |      | 2022-04-19 | a    | 2022-04-19 00:00:01 |
|  2 |    1 | a    | 2022-04-19 | a    | 2022-04-19 00:00:01 |
|  3 |    1 | a    | 2022-04-19 | a    | 2022-04-19 00:00:01 |
|  4 |    1 | a    | 2022-04-19 | a    | 2022-04-19 00:00:01 |
+----+------+------+------------+------+---------------------+

3. What did you see instead (Required)

  1. duplicate warnings
  2. only one row loaded
mysql> select * from t66;
+----+------+------+------------+------+---------------------+
| id | k    | c    | dt         | vv   | ts                  |
+----+------+------+------------+------+---------------------+
|  1 |    1 |      | 2022-04-19 | a    | 2022-04-19 00:00:01 |
+----+------+------+------------+------+---------------------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

v5.0.0 and above should be affected, because it is introduced by #18753 .

Metadata

Metadata

Assignees

Labels

affects-5.0This bug affects 5.0.x versions.affects-5.1This bug affects 5.1.x versions.affects-5.2This bug affects 5.2.x versions.affects-5.3This bug affects 5.3.x versions.affects-5.4This bug affects the 5.4.x(LTS) versions.affects-6.0affects-6.1This bug affects the 6.1.x(LTS) versions.severity/majorsig/transactionSIG:Transactiontype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions