Re: How to specify that a trigger should fire when column is NOT in SET-clause?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: Andreas Joseph Krogh <andreas(at)visena(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to specify that a trigger should fire when column is NOT in SET-clause?
Date: 2020-12-25 16:57:21
Message-ID: 1160652.1608915441@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> writes:
> On 12/25/20 5:52 AM, Andreas Joseph Krogh wrote:
>> Or - is it possible to check for this in the trigger-function?

> As David Johnson mentioned you can check whether the value for the
> column is changed:

> NEW.animal <> OLD.animal

Better to use IS DISTINCT FROM, to get sane behavior when one or
the other value is NULL.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Joseph Krogh 2020-12-25 18:19:38 Re: How to specify that a trigger should fire when column is NOT in SET-clause?
Previous Message Adrian Klaver 2020-12-25 16:48:39 Re: How to specify that a trigger should fire when column is NOT in SET-clause?