I have the following table in PostgreSQL:
CREATE TABLE cars (id SERIAL PRIMARY KEY,
car_id SERIAL REFERENCES car_models (id) ON DELETE CASCADE);
When using COPY with the following:
COPY cars FROM '/Users/my-user/cars.csv' DELIMITER ',' CSV HEADER;
Containing:
id, car_id
1, 4
2, 3
3, 9
Then my primary key aren't incremented, so calling afterwards:
insert into cars (car_id) values (11)
fails with:
ERROR: duplicate key value violates unique constraint "cars_pkey"
DETAIL: Key (id)=(1) already exists.