Re: How to implement the skip errors for copy from ?

From: Vik Fearing <vik(dot)fearing(at)dalibo(dot)com>
To: xbzhang <xbzhang(at)kingbase(dot)com(dot)cn>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to implement the skip errors for copy from ?
Date: 2014-05-29 13:26:06
Message-ID: 5387356E.7080802@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 05/29/2014 09:25 AM, xbzhang wrote:
> I want to implement the skip errors for copy from,lik as :
> create table A (c int primary key);
> copy A from stdin;
> 1
> 1
> 2
> \.
>
> copy will failed:
> ERROR: duplicate key violates primary key constraint "CC_PKEY"
> CONTEXT: COPY CC, line 2: "1"
>
> I want skip the error, and continue to copy the reset of tuple. The result
> will be that there are two rows in table A: 1 and 2.
>
> how to implement that ?

Have a look at pgloader. http://pgloader.tapoueh.org/

--
Vik

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-05-29 13:29:21 Re: How to implement the skip errors for copy from ?
Previous Message Tom Lane 2014-05-29 13:25:39 Re: Fwd: libpq: indefinite block on poll during network problems