Insert (ignore) with unique constraint on - Mailing list pgsql-general

From Victor Ciurus
Subject Insert (ignore) with unique constraint on
Date
Msg-id e7a72f4004112505347278a976@mail.gmail.com
Whole thread Raw
List pgsql-general
Hi all,

What I'am trying to do using Postgresql is to make and "INSERT into
table A (2 fields) (select * from Table B) - (2 fields + unique btree
Index)" or a "COPY table_B from FILE using...". The problem is that
everytime I get duplicates from table A into table B the insert will
stop with the typical error: 'ERROR:  duplicate key violates unique
constraint "string_idx"'

Q: Is there a way (like in MySQL's INSERT IGNORE) of going on with the
INSERT / COPY FROM ... even if a dupplicate / unique constraint
violation shows on! Somekind of a 'exception/error treating' routine
in SQL or PG-PL?

Any help will be highly appreciated.

Regards,
Victor

pgsql-general by date:

Previous
From: "Katsaros Kwn/nos"
Date:
Subject: SPI memory overrun details
Next
From: Richard Huxton
Date:
Subject: Re: Benchmark-Comparison PostGreSQL vs. SQL Server