patternsqlMinor
Postgres COPY with on conflict ignore - possible?
Viewed 0 times
ignorepostgreswithpossibleconflictcopy
Problem
I want to add on conflict ignore to the Postgres
I know I can copy the data to a table without unique index /primary key and then use insert with the
But I wanted to know if this is possible directly from
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?Solution
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
Context
StackExchange Database Administrators Q#283479, answer score: 8
Revisions (0)
No revisions yet.