Race hazard deleting using CTID?

Поиск
Список
Период
Сортировка
От Peter Headland
Тема Race hazard deleting using CTID?
Дата
Msg-id 71F491F5DA99604A80DE49424BF3D02B0C7293A0@exchange8.actuate.com
обсуждение исходный текст
Ответы Re: Race hazard deleting using CTID?
Список pgsql-general
I believe that the following statement was originally suggested by Tom Lane; I got it from Pavel Stehule's PostgreSQL
Tipspage.
 
My question is, does this code contain a race hazard, because the list from the SELECT might get changed by another
sessionbefore the DELETE uses it?
 

  delete from del where ctid = any(array(select ctid from del limit 10))

If so, am I correct to think that adding FOR UPDATE to create the version below would eliminate the hazard?

  delete from del where ctid = any(array(select ctid from del limit 10 for update))

-- 
Peter Headland
Architect
Actuate Corporation


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

Предыдущее
От: "Peter Headland"
Дата:
Сообщение: Does PERFORM hold a lock?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Race hazard deleting using CTID?