Re: Referential Integrity and SHARE locks

Поиск
Список
Период
Сортировка
От Florian G. Pflug
Тема Re: Referential Integrity and SHARE locks
Дата
Msg-id 45C328BC.5090404@phlo.org
обсуждение исходный текст
Ответ на Re: Referential Integrity and SHARE locks  (Csaba Nagy <nagy@ecircle-ag.com>)
Список pgsql-hackers
Csaba Nagy wrote:
> The reason of the occasional orphan rows is not completely clear to me,
> but it must be some kind of race condition while
> inserting/deleting/?updating concurrently the parent/child tables.

I guess the following sequence would generate a orphaned row.
A: executes "insert into table_child parent_id=1"
B: executes "delete from table_parent where id=1"
A: RI trigger checks for matching row in table_parent
B: The row with id=1 is marked as deleted in table_parent
A: The new row with parent_id=1 is inserted into table_child
B: The delete is commited
A: The insert is comitted.

Any ordering that marks the row as deleted between the execution
of the ri-trigger and the insertion of the new row would lead
to the same result..

greetings, Florian Pflug


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

Предыдущее
От: Csaba Nagy
Дата:
Сообщение: Re: Referential Integrity and SHARE locks
Следующее
От: Gavin Sherry
Дата:
Сообщение: Re: Bitmap index thoughts