I have a CSV file which contains 1 filed. I want to import this filed values into a MariaDB table using the LOAD DATA INFILE command. This table has 9 columns with existing data (about 1 000 000 rows). The 9th one was added with alter table statement and contains the same default value. We need to overwrite these default values with the values of the CSV field.
When I run the following statement
LOAD DATA LOCAL INFILE '/tmp/file.csv'
REPLACE INTO TABLE myTable
CHARACTER SET utf8
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES
(column9);
I get this warning
Warning | 1062 | Duplicate entry '0' for key 'PRIMARY'
I seems MariaDB always try to put these values into the first column witch is the ID of the table.