Insert (ignore) with unique constraint on

From: Victor Ciurus <vikcious(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Insert (ignore) with unique constraint on
Date: 2004-11-25 13:34:51
Message-ID: e7a72f4004112505347278a976@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2004-11-25 13:45:20 Re: Benchmark-Comparison PostGreSQL vs. SQL Server
Previous Message Katsaros Kwn/nos 2004-11-25 13:33:37 SPI memory overrun details