Re: Duplicate key insert question

From: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
To: Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Duplicate key insert question
Date: 2003-07-02 01:23:22
Message-ID: 3F02340A.9050205@mega-bucks.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Christian Imbeault 2003-07-02 01:25:54 Re: Duplicate key insert question
Previous Message Alvaro Herrera 2003-07-02 01:16:02 Re: Duplicate key insert question