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