Re: [SQL] Concurrency problem

Поиск
Список
Период
Сортировка
От wieck@debis.com (Jan Wieck)
Тема Re: [SQL] Concurrency problem
Дата
Msg-id m12GhZA-0003kbC@orion.SAPserv.Hamburg.dsh.de
обсуждение исходный текст
Ответ на Concurrency problem  (Taral <taral@taral.net>)
Ответы Re: [SQL] Concurrency problem
Список pgsql-sql
> I have a small problem, and was wondering if there was a better fix than
> the one I have.
>
> Here goes: I have tables A and B, both with primary keys. A has a field
> which refers to rows of B, and vice versa. When these fields are modified,
> I want to ensure referential integrity, but without using triggers. Is it
> possible to avoid deadlock and preserve integrity in all situations
> without serializing the updates?
>
> Details: Without any locking, an update of A concurrent with a delete on B
> will cause an integrity breach. With locking, concurrent updates of A and
> B can cause a deadlock...
   You  cannot  use  a  regular trigger because of your circular   dependency. What you really need to insure integrity
is  the   FOREIGN  KEY  support  coming  with 7.0. It is implemented as   triggers too, but they are handled a little
differentby  the   trigger  manager  and  their  execution  can be delayed until   COMMIT.
 


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #




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

Предыдущее
От: Taral
Дата:
Сообщение: Concurrency problem
Следующее
От: "Gerhard Dieringer"
Дата:
Сообщение: Re: [SQL] Concurrency problem