From: Michael Fuhr <mike@fuhr.org>
To: David Bear <David.Bear@asu.edu>
Cc: pgsql-admin@postgresql.org
Subject: Re: psql copy errors
Date: Thu, 23 Jun 2005 14:17:16 -0600
Message-ID: <20050623201715.GA38419@winnie.fuhr.org> (raw)
In-Reply-To: <20050623192744.GC398@asu.edu>
References: <20050623192744.GC398@asu.edu>
On Thu, Jun 23, 2005 at 12:27:44PM -0700, David Bear wrote:
>
> I'm finding the \copy is very brittle. It seems to stop for everyone
> little reason. Is there a way to tell it to be more forgiving -- for
> example, to ignore extra data fields that might exists on a line?
>
> Or, to have it just skip that offending record but continue on to the
> next.
Calling this behavior "brittle" is debatable; some people would
call it "reliable": either the whole input validates -- matches
what's expected -- or the command rejects it. This might sound
unreasonable if a partial load is acceptable, but it's desirable
behavior if a partial load is unacceptable. Some would argue that
the correct solution is to fix the data, not to make the command
that loads the data more forgiving.
The developers' TODO list has a few outstanding items to enhance
COPY, but I don't know if anybody's working on them:
http://www.postgresql.org/docs/faqs.TODO.html
* Allow COPY to report error lines and continue
This requires the use of a savepoint before each COPY line is processed,
with ROLLBACK on COPY failure.
* Have COPY return the number of rows loaded/unloaded (?)
--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: mike@fuhr.org, David.Bear@asu.edu
Subject: Re: psql copy errors
In-Reply-To: <20050623201715.GA38419@winnie.fuhr.org>
References: <20050623192744.GC398@asu.edu> <20050623201715.GA38419@winnie.fuhr.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox