From: Tim Landscheidt <tim@tim-landscheidt.de>
To: pgsql-sql@postgresql.org
Subject: Re: import ignoring duplicates
Date: Mon, 17 May 2010 00:32:00 +0000
Message-ID: <m3y6fjwepr.fsf@passepartout.tim-landscheidt.de> (raw)
References: <4BF03B89.9020908@noaa.gov>
Mark Fenbers <Mark.Fenbers@noaa.gov> wrote:
> I am using psql's \copy command to add records to a database
> from a file. The file has over 100,000 lines.
> Occasionally, there is a duplicate, and the import ceases
> and an internal rollback is performed. In other words, no
> data is imported even if the first error occurs near the end
> of the file.
> I am looking for an option/switch to tell psql (or the \copy
> command) to skip over any duplicate key constraint
> viloations and continue to load any data that doesn't
> violate a duplicate key constraint. Is there such an
> option?
No. You can either disable the constraint temporarily, im-
port the data, fix any duplicates and re-enable the con-
straint, or you can load the data in a temporary table and
then transfer only the valid data. With only 100000 records
I would opt for the latter.
Tim
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tim@tim-landscheidt.de
Subject: Re: import ignoring duplicates
In-Reply-To: <m3y6fjwepr.fsf@passepartout.tim-landscheidt.de>
* 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