Re: Trigger loop question

Поиск
Список
Период
Сортировка
От Gregory Wood
Тема Re: Trigger loop question
Дата
Msg-id 4056705B.7010001@ewebengine.com
обсуждение исходный текст
Ответ на Re: Trigger loop question  (Mike Nolan <nolan@gw.tssi.com>)
Ответы Re: Trigger loop question
Список pgsql-general
Mike Nolan wrote:

> However, if I update table 'B' and the 2nd trigger fires, that trigger
> will still see the OLD value if does a query on table 'A', since I
> think transaction atomic rules require that any updated values aren't
> made available to the outside world (including other triggers) until the
> transaction is complete.

I could be mistaken here, but... I don't believe that is the case. The
transaction can see what's going on inside of itself. Everything outside
of the transaction typically won't see what is inside the transaction,
until it is committed anyway.

> I tested this, and the 2nd trigger still sees the original value of
> the field from the first table, which I think is the proper result.

I think this has more to do with whether the first trigger was fired
BEFORE or AFTER the UPDATE. If the first trigger is fired BEFORE the
UPDATE, then the second trigger (fired on the UPDATE) will not see the
AFTER values of the first trigger. If you fire the first trigger as
AFTER, I bet you'll see the changes.

Greg

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

Предыдущее
От: Andreas
Дата:
Сообщение: Re: Postmaster won't run as service on Cygwin
Следующее
От: Andreas
Дата:
Сообщение: Re: Postmaster won't run as service on Cygwin