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

From Jean-Christian Imbeault
Subject Re: Duplicate key insert question
Date
Msg-id 3F02340A.9050205@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:
>
> The thread is here:
>
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=3A4D6116.1A613402%40mascari.com&rnum=1&prev=/groups%3Fq%3DMike%2BMascari%2BINSERT%2BNOT%2BEXISTS%26ie%3D

Thanks!

> The solution is not correct in that there _is_ a race condition.

I thought so :(

>>No, what I want if to have one query that will *always* insert if there
>>is no record with this primary key and *always* do nothing (not fail,
>>not generate an error) if there is already a record with this primary
>>key. I don't want to check return values :)
>
>
> No way.

I was beginning to think so. Thanks for confirming my suspicions.

In your opinion what is the best solution, if we define best as not
generating any error messages and executing as quickly as possible?

Thanks,

Jean-Christian Imbeault


pgsql-general by date:

Previous
From: "Reuben D. Budiardja"
Date:
Subject: Re: Duplicate key insert question
Next
From: "Dann Corbit"
Date:
Subject: Re: Duplicate key insert question