Re: identity column behavior in WHEN condition for BEFORE EACH ROW trigger

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: identity column behavior in WHEN condition for BEFORE EACH ROW trigger
Date: 2019-10-07 18:14:34
Message-ID: d6ed24d1-02f3-ad84-89ec-08117e39b344@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-10-03 16:08, Suraj Kharage wrote:
> It is been observed that when we define the generated columns in WHEN
> condition for BEFORE EACH ROW trigger then server throw an error from
> CreateTrigger().

> whereas, for identity columns, server allows us to create trigger for
> same and trigger gets invoked as defined. Is this behavior expected? or
> we need to restrict the identity columns in such scenario because anyone
> one override the identity column value in trigger.

This is per SQL standard: Identity columns are assigned before triggers,
generated columns are computed after BEFORE triggers.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2019-10-07 18:33:02 Re: Transparent Data Encryption (TDE) and encrypted files
Previous Message Tom Lane 2019-10-07 17:57:41 Re: expressive test macros (was: Report test_atomic_ops() failures consistently, via macros)