Skip to content

Enclosed fields not handled correctly in LOAD DATA #9969

@Webbmekanikern

Description

@Webbmekanikern

Related: #9884

Dolt 1.59.20.

Problem

When enclosing a field in LOAD DATA, any character should be allowed in the field except the enclosing character itself, unless it's escaped. That's not the case here.

If I terminate fields with a comma, I will get a "field not properly enclosed" error if any field contains a comma, despite the fact that the field is enclosed by quotes.

Schema:

CREATE TABLE `my_table` (
  `id` int NOT NULL,
  `txt` varchar(16) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

Query:

LOAD DATA LOCAL INFILE 'data'
INTO TABLE my_table
FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY '"'
LINES TERMINATED BY '\n'
(id, txt)

Data:

"1","foo,bar"

Expected result (MySQL / MariaDB):

id txt
1 foo,bar

Actual result (Dolt 1.59.20):

Error 1105 (HY000): error: field not properly enclosed

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions