Re: How to prevent duplicate key error when two processes do DELETE/INSERT simultaneously?

Поиск
Список
Период
Сортировка
От Alex Hunsaker
Тема Re: How to prevent duplicate key error when two processes do DELETE/INSERT simultaneously?
Дата
Msg-id 34d269d40907292130n2cffd20g25baf9f8b51f530c@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to prevent duplicate key error when two processes do DELETE/INSERT simultaneously?  (Brodie Thiesfield <brofield+pgsql@gmail.com>)
Список pgsql-general
On Wed, Jul 29, 2009 at 19:53, Brodie
Thiesfield<brofield+pgsql@gmail.com> wrote:
> On further investigation, since the logic requires the delete to be
> made first to get rid of other possible rows, so I'll go with:
>
> DELETE
> (if supported)  INSERT OR REPLACE
> (otherwise)             INSERT, if duplicate key, UPDATE
>

You can use plpgsql to emulate insert or replace (I think there are
some comments on emulating mysql specifically in the commented
versions of the docs somewhere... but thats up to you to find em) see
http://www.postgresql.org/docs/8.4/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
example 38-1

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Blog post about Amazon Elastic Block Storage
Следующее
От: Thomas Kellerer
Дата:
Сообщение: pg_stat_activity undocumented?