Re: MERGE vs REPLACE

Поиск
Список
Период
Сортировка
От Gavin Sherry
Тема Re: MERGE vs REPLACE
Дата
Msg-id Pine.LNX.4.58.0511121022590.25926@linuxworld.com.au
обсуждение исходный текст
Ответ на Re: MERGE vs REPLACE  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers
On Fri, 11 Nov 2005, Josh Berkus wrote:

> Jaime,
>
> > why? seems that REPLACE only work if there are at least one row
> > matching...
>
> Scenario:
>
> session1: REPLACE .... 1
>                   session2:  REPLACE ..... 1
> session1: check to see that "1" exists .... no
>                   session2: check to see that "1" exists .... no
> session1: INSERT 1
>                   session2: INSERT 1 .... ERROR
>
> Get the picture?  The only way to avoid a race condition is to be able to
> do "predicate locking", that is to lock the table against any data write
> matching that predicate.

When it comes to predicate locking, I think we should defer to Peter's
comment at Open DB Con:

http://www.treehou.se/~swm/peter_merge.jpg

Gavin


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: MERGE vs REPLACE
Следующее
От: mark@mark.mielke.cc
Дата:
Сообщение: Re: MERGE vs REPLACE