Skip site navigation (1) Skip section navigation (2)

Re: COPY command with bad input

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Sandeep Khandelwal <sandeep_khandelwal27(at)yahoo(dot)com>
Cc: pgsql-interfaces(at)postgresql(dot)org
Subject: Re: COPY command with bad input
Date: 2007-05-17 12:10:42
Message-ID: 20070517121042.GA26576@winnie.fuhr.org (view raw or flat)
Thread:
Lists: pgsql-interfaces
On Tue, May 15, 2007 at 02:11:00AM -0700, Sandeep Khandelwal wrote:
> I am trying to load data from a text file to Postgres table using
> COPY command. If text file has some invalid rows then COPY command
> stops at the first error.
> 
> As you can see, MySQL “load data infile” has IGNORE option.  If you
> specify IGNORE, input rows that duplicate an existing row on a
> unique key value are skipped. Do we have similar option for Postgres
> COPY command ?

Not yet; it's on the developers' TODO list:

http://www.postgresql.org/docs/faqs.TODO.html

  * Allow COPY to report error lines and continue

In the meantime you could check out pgloader:

http://pgfoundry.org/projects/pgloader/

-- 
Michael Fuhr

In response to

pgsql-interfaces by date

Next:From: john heasleyDate: 2007-05-17 16:48:00
Subject: libpq: NULL in binary parameters
Previous:From: Sandeep KhandelwalDate: 2007-05-17 03:23:49
Subject: Re: COPY command with bad input

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group