upsert postgres
snippet in sql

upsert postgres

user2889

INSERT INTO table_name(column_list)
VALUES(value_list)
ON CONFLICT target [DO NOTHING]

-- or 
    
INSERT INTO table_name(column_list)
VALUES(value_list)
ON CONFLICT target DO UPDATE SET column_1 = value_1, .. WHERE condition]