From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Jitendra Loyal <jitendra(dot)loyal(at)gmail(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: BEFORE ... Statement-level trigger |
Date: | 2019-02-18 21:55:09 |
Message-ID: | 6241dc72-4291-0713-1a3e-97b4f006e933@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2019-02-18 22:14:16 | Re: WSL (windows subsystem on linux) users will need to turn fsync off as of 11.2 |
Previous Message | Adrian Klaver | 2019-02-18 21:49:28 | Re: Statement-level trigger results in recursion |