Bug #11837 LOAD DATA ignores 1 line too much when ignored lines do not end with FIELD TERM
Submitted: 9 Jul 2005 16:24 Modified: 11 Aug 2005 13:54
Reporter: Oliver Baltz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:All OS:Any (All)
Assigned to: CPU Architecture:Any

[9 Jul 2005 16:24] Oliver Baltz
Description:
LOAD DATA ignores too much lines when the ignored line does not end with FIELD TERMINATOR

How to repeat:
file.csv contains:
"field1","field2"
"field3","field4"

mysql> LOAD DATA LOCAL INFILE 'file.csv' INTO TABLE XXX FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 LINES

You`ll see that both lines will be ignored! 

Correct import works if file.csv would look like:
"field11","field2",
"field3","field4",

This is a quite stupid bug because some programs like Microsoft Works save CSV-data without the field-terminator when the line ends.

As a conclusion you are not able to import data correctly!
[10 Jul 2005 5:29] Aleksey Kishkin
Hi! could you please specify what mysql versions did you test?

I checked against 5.0.7 and got:

mysql -u root test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.7-beta-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table XXX (i char(20), i1 varchar(20));
Query OK, 0 rows affected (0.02 sec)

mysql> LOAD DATA LOCAL INFILE '/tmp/file.csv' INTO TABLE XXX FIELDS TERMINATED B Y ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' IGNORE 1 LINES
    -> 
    -> ;
Query OK, 1 row affected (0.00 sec)
Records: 1  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from XXX;
+------+------+
| i    | i1   |
+------+------+
| fld3 | fld4 |
+------+------+
1 row in set (0.00 sec)

mysql> \q
Bye
bash-2.05b$ cat /tmp/file.csv
"fld1","fld2"
"fld3","fld4"
[10 Aug 2005 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[11 Aug 2005 13:54] Oliver Baltz
Could not repeat the error.