Re: skip duplicate key error during inserts

From: "Jeffrey Webster" <icwebby(at)gmail(dot)com>
To: "Jean-Christophe Roux" <jcxxr(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: skip duplicate key error during inserts
Date: 2006-10-22 09:39:18
Message-ID: 8c0cc2820610220239r62ff82dap95d756e17bfe8413@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/20/06, Jean-Christophe Roux <jcxxr(at)yahoo(dot)com> wrote:
>
> Hello,
> [snip]
>

none of them will be inserted because the first insert is a primary key
> violation. How can I have postgreSQL not mind about the error and proceed to
> the next insert. I could send the inserts one at a time but bundling them
> speeds up the process.
> Thanks
>
>
I feel your pain... However, there is no way to do this (currently?). Some
possible solutions had been suggested some time back by a colleague, but
they were rejected. It requires a source code change (and not a simple one,
at that) to implement.

Until a concensus is reached by the primary contributors there is no easy
answer.

We've resorted to batch loading and parsing error messages to load all data
between primary key violations. It's still considerably more efficient than
single inserts.

(we've got the code to accomplish what you're asking about in the attic...
hopefully something will come of it some day.)

Best of luck.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2006-10-22 10:24:46 Re: skip duplicate key error during inserts
Previous Message Thomas Pundt 2006-10-22 07:55:23 Re: How to find out about zlib compression