pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Andreas Joseph Krogh <andreas@visena.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How to specify that a trigger should fire when column is NOT in SET-clause?
Date: Fri, 25 Dec 2020 11:57:21 -0500
Message-ID: <1160652.1608915441@sss.pgh.pa.us> (raw)
In-Reply-To: <dacbcd40-3cef-074b-71a6-f1806884f62b@aklaver.com>
References: <VisenaEmail.26.7cbf2947c8d23ceb.1769a2755ff@tc7-visena>
	<dacbcd40-3cef-074b-71a6-f1806884f62b@aklaver.com>

Adrian Klaver <adrian.klaver@aklaver.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





view thread (6+ messages)  latest in thread

Message-ID: <1160652.1608915441@sss.pgh.pa.us>
Permalink:  ../1160652.1608915441@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1160652.1608915441@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com, andreas@visena.com
  Subject: Re: How to specify that a trigger should fire when column is NOT in SET-clause?
  In-Reply-To: <1160652.1608915441@sss.pgh.pa.us>
  References: <VisenaEmail.26.7cbf2947c8d23ceb.1769a2755ff@tc7-visena> <dacbcd40-3cef-074b-71a6-f1806884f62b@aklaver.com> <1160652.1608915441@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox