Re: Duplicate key insert question - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject Re: Duplicate key insert question
Date
Msg-id 3F0238D4.1030307@mega-bucks.co.jp
Whole thread Raw
In response to Duplicate key insert question  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
List pgsql-general
Alvaro Herrera wrote:
>
> Well, he is right.  One will fail, the other will not.  The race
> condition is for the application.  If you want to ignore it, you can do
> that, but there _will_ be an ERROR thrown and the transaction will be
> aborted.

Ah ... then maybe this solution is 'good enough'. It will still generate
 an error message some of the time (when there is a race condition) but
will definitely generate fewer error messages than the current method
used which is just to do the insert and let it fail if there is already
a record with the same primary key.

Thanks for the help!

Jean-Christian Imbeault


pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Duplicate key insert question
Next
From: "Dann Corbit"
Date:
Subject: Re: Duplicate key insert question