In dit SO-bericht staan twee antwoorden die -samen gecombineerd- een mooie oplossing bieden voor het succesvol gebruiken van ON CONFLICT . Het onderstaande voorbeeld gebruikt ON CONFLICT DO NOTHING; :
CREATE TEMP TABLE tmp_table
(LIKE label INCLUDING DEFAULTS)
ON COMMIT DROP;
COPY tmp_table FROM 'full/file/name/here';
INSERT INTO main_table
SELECT *
FROM tmp_table
ON CONFLICT DO NOTHING;