Re: ignore duplicate key while using COPY?

From: David Johnston <polobo(at)yahoo(dot)com>
To: Yan Chunlu <springrider(at)gmail(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: ignore duplicate key while using COPY?
Date: 2011-12-19 07:05:56
Message-ID: 72D6834E-9FA0-4BBA-B985-BB1561E55841@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Copy to a staging table without the constraint and then write a query to consolidate/remove the duplicate data and insert the clean data into the final table.

It doesn't just give a warning because not importing a record from the source data should be a fatal error since it means you have a design mis-match surrounding your import procedure.

David J.

On Dec 19, 2011, at 1:54, Yan Chunlu <springrider(at)gmail(dot)com> wrote:

> I am using COPY public.table_name FROM STDIN to import data. it is
> very efficient, but if there's any duplicate key exists, the whole
> procedure has been stopped. is there anyway to around this?
>
> why does not postgresql just give a warning and continue the copy?
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Капралов Александр 2011-12-19 07:16:06 Re: How to make a non-removable row in a table?
Previous Message Thomas Markus 2011-12-19 06:56:21 Re: How to make a non-removable row in a table?