on conflict updating and inserting code example
Example: upsert postgres
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]