2

I want to add on conflict ignore to the Postgres copy command. I know I can copy the data to a table without unique index /primary key and then use insert with the on conflict syntax. But I wanted to know if this is possible directly from COPY?

2

No. Maybe in some future version. Now about the best you can do is use file_fdw to map the file in as a foreign table, and then INSERT INTO...SELECT...ON CONFLICT DO NOTHING

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.