Re: most idiomatic way to "update or insert"?

Поиск
Список
Период
Сортировка
От Mike Mascari
Тема Re: most idiomatic way to "update or insert"?
Дата
Msg-id 41123B36.6050909@mascari.com
обсуждение исходный текст
Ответ на Re: most idiomatic way to "update or insert"?  ("Peter Darley" <pdarley@kinesis-cem.com>)
Ответы Re: most idiomatic way to "update or insert"?  ("Peter Darley" <pdarley@kinesis-cem.com>)
Список pgsql-general
Peter Darley wrote:
> Lincoln, It works for me... I think what you said is wrong
> because it updates first (if there is a row to update), then
> inserts.  If there is a row to update the insert won't insert
> anything.  If there is no row to update the insert inserts a row.
>  Either way, the insert is the last thing in the transaction.
> Plus, as shown in the code to follow, I have almost this exact
> thing in my application and I know that it does work for me. :)

You're getting lucky. I suggested the same thing four years ago. The
race condition is still there:

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=2344.978158285%40sss.pgh.pa.us

HTH,

Mike Mascari


В списке pgsql-general по дате отправления:

Предыдущее
От: Cott Lang
Дата:
Сообщение: PG over NFS tips
Следующее
От: Csaba Nagy
Дата:
Сообщение: Re: most idiomatic way to "update or insert"?