I want to do
\" on conflict (time) do update set name , description \"
but I have no idea when I use stdin with csv , I don\'t know what n
In this SO post, there are two answers that -combined together- provide a nice solution for successfully using ON CONFLICT
. The example below, uses 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;