Re: SQL design pattern for a delta trigger?

Поиск
Список
Период
Сортировка
От Vivek Khera
Тема Re: SQL design pattern for a delta trigger?
Дата
Msg-id FF08171D-0F1F-4AA7-91F4-ACE7D345D591@kcilink.com
обсуждение исходный текст
Ответ на Re: SQL design pattern for a delta trigger?  (Colin Wetherbee <cww@denterprises.org>)
Ответы Re: SQL design pattern for a delta trigger?  (Ted Byers <r.ted.byers@rogers.com>)
Re: SQL design pattern for a delta trigger?  (Colin Wetherbee <cww@denterprises.org>)
Список pgsql-general
On Dec 10, 2007, at 5:04 PM, Colin Wetherbee wrote:

> For what it's worth, the real algorithm would be as follows.  I
> hadn't had enough coffee yet, and I forgot the UPDATE bit.
>
> IF
>  (a query matching your old data returns rows)
> THEN
>  UPDATE with your new data
> ELSE
>  INSERT your new data

Still exists race condition.  Your race comes from testing existence,
then creating/modifying data afterwards.  You need to make the test/
set atomic else you have race.


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

Предыдущее
От: Vivek Khera
Дата:
Сообщение: Re: Script to reset all sequence values in the a given DB?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: partitioned table query question