On 2/18/19 8:20 AM, Jitendra Loyal wrote:
Thanks Adrian
I am trying to understand as to how a BEFORE statement-level trigger can
be used. Since it is a trigger, one needs to know which rows are being
affected.
But you can't:
https://www.postgresql.org/docs/10/plpgsql-trigger.html
"NEW
Data type RECORD; variable holding the new database row for
INSERT/UPDATE operations in row-level triggers. This variable is
unassigned in statement-level triggers and for DELETE operations.
OLD
Data type RECORD; variable holding the old database row for
UPDATE/DELETE operations in row-level triggers. This variable is
unassigned in statement-level triggers and for INSERT operations.
"
Regards,
Jiten
On Mon 18 Feb, 2019, 9:42 PM Adrian Klaver, <adrian.klaver@xxxxxxxxxxx
<mailto:adrian.klaver@xxxxxxxxxxx>> wrote:
On 2/18/19 4:06 AM, Jitendra Loyal wrote:
> The behaviour is not clear for BEFORE Statement-level Trigger.
This is
> because transition tables cannot be used. So how does one get
access to
> the rows being affected? It is not documented either.
If you need the row values then use a FOR ROW trigger.
>
> Thanks
> Jiten
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx <mailto:adrian.klaver@xxxxxxxxxxx>
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx