Re: BEFORE ... Statement-level trigger

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: BEFORE ... Statement-level trigger
Дата
Msg-id 6241dc72-4291-0713-1a3e-97b4f006e933@aklaver.com
обсуждение исходный текст
Ответ на BEFORE ... Statement-level trigger  (Jitendra Loyal <jitendra.loyal@gmail.com>)
Ответы Re: BEFORE ... Statement-level trigger  (Jitendra Loyal <jitendra.loyal@gmail.com>)
Список pgsql-general
On 2/18/19 9:11 AM, Jitendra Loyal wrote:
> I have gone through the documentation quite a number of times to 
> establish the understanding. However, I had been wondering about the 
> recursion in the case I put forth.
> 
> Is there a better way to handle this requirement? The point is that the 
> trigger is being called when no rows are affected.

Well as the docs say a FOR EACH STATEMENT trigger will execute in the 
absence of changed rows. So you have two options:

1) Use a FOR EACH ROW trigger.

2) Do what you did and include a sanity check.

Best guess is your AFTER STATEMENT trigger is tripping your BEFORE ROW 
trigger which then trips your AFTER STATEMENT and so on.

> 
> Thanks and regards,
> Jiten


-- 
Adrian Klaver
adrian.klaver@aklaver.com


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Statement-level trigger results in recursion
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: WSL (windows subsystem on linux) users will need to turn fsyncoff as of 11.2