> On Jan 1, 2021, at 07:56, Dirk Mika <dirk.m...@mikatiming.de> wrote:
> In particular, columns are populated with values if they are not specified in
> the update statement which is used.
> Usually with an expression like this:
>
> IF NOT UPDATING('IS_CANCELED')
> THEN
> :new.is_canceled := ...;
> END IF;
>
> I have not found anything similar in PostgreSQL. What is the common approach
> to this problem?
PostgreSQL doesn't have an exact equivalent. Typically, the OLD and NEW values
are compared and then action is taken based on that. For example, in PL/pgSQL:
IF NEW.is_canceled IS NOT DISTINCT FROM OLD.is_canceled THEN
NEW.is_canceled := etc etc ;
ENDIF;
There's currently no way to detect if the column was simply not mentioned at
all in the UPDATE statement.
--
-- Christophe Pettus
x...@thebuild.com