Re: Bulkloading using COPY - ignore duplicates?

Vadim Mikheev <vmikheev@sectorbase.com>

From: "Vadim Mikheev" <vmikheev@sectorbase.com>
To: "Bruce Momjian" <pgman@candle.pha.pa.us>, "Daniel Kalchev" <daniel@digsys.bg>
Cc: "Tom Lane" <tgl@sss.pgh.pa.us>, "Lee Kindness" <lkindness@csl.co.uk>, "Peter Eisentraut" <peter_e@gmx.net>, "Jim Buttafuoco" <jim@buttafuoco.net>, "PostgreSQL Development" <pgsql-hackers@postgresql.org>
Date: 2002-01-04T07:47:36Z
Lists: pgsql-hackers
> Now, how about the same functionality for
>
> INSERT into table1 SELECT * from table2 ... WITH ERRORS;
>
> Should allow the insert to complete, even if table1 has unique indexes and
we
> try to insert duplicate rows. Might save LOTS of time in bulkloading
scripts
> not having to do single INSERTs.

1. I prefer Oracle' (and others, I believe) way - put statement(s) in PL
block and define
for what exceptions (errors) what actions should be taken (ie IGNORE for
NON_UNIQ_KEY
error, etc).

2. For INSERT ... SELECT statement one can put DISTINCT in select' target
list.

> Guess all this will be available in 7.3?

We'll see.

Vadim