postgresql ignore exception when duplicate insert code example
Example: To ignore duplicate keys during 'copy from' in postgresql
create temp table tmp_table on commit drop as select * from brand with no data;
copy tmp_table (name,slug) from '/var/lib/postgresql/data/Brands.csv' DELIMITER ',' csv header;
insert into brand select distinct on (slug) * from tmp_table;