Re: identity column behavior in WHEN condition for BEFORE EACH ROWtrigger - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: identity column behavior in WHEN condition for BEFORE EACH ROWtrigger
Date
Msg-id d6ed24d1-02f3-ad84-89ec-08117e39b344@2ndquadrant.com
Whole thread Raw
In response to identity column behavior in WHEN condition for BEFORE EACH ROW trigger  (Suraj Kharage <suraj.kharage@enterprisedb.com>)
List 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: expressive test macros (was: Report test_atomic_ops() failures consistently, via macros)
Next
From: Magnus Hagander
Date:
Subject: Re: Transparent Data Encryption (TDE) and encrypted files