Re: MERGE vs REPLACE

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: MERGE vs REPLACE
Дата
Msg-id 200511111440.54848.josh@agliodbs.com
обсуждение исходный текст
Ответ на Re: MERGE vs REPLACE  (Jaime Casanova <systemguards@gmail.com>)
Ответы Re: MERGE vs REPLACE  (Rod Taylor <pg@rbt.ca>)
Re: MERGE vs REPLACE  (Gavin Sherry <swm@linuxworld.com.au>)
Re: MERGE vs REPLACE  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
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.

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco


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

Предыдущее
От: Bryan White
Дата:
Сообщение: Re: How to find a number of connections
Следующее
От: Rod Taylor
Дата:
Сообщение: Re: MERGE vs REPLACE