Re: Detecting changes to certain fields in 'before update' trigger functions

From: "Richard Broersma" <richard(dot)broersma(at)gmail(dot)com>
To: "Sebastian Tennant" <sebyte(at)smolny(dot)plus(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Detecting changes to certain fields in 'before update' trigger functions
Date: 2008-12-01 16:03:50
Message-ID: 396486430812010803t490255ddr3bd6f42a1e3c0f84@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Dec 1, 2008 at 7:18 AM, Sebastian Tennant
<sebyte(at)smolny(dot)plus(dot)com> wrote:

> IF (NEW.<column-name> != OLD.<column-name>) THEN ...

The != operator doesn't work the way you might think when nulls are
thrown into the mix. I asked a similar question a while back and was
kindly pointed to the following syntax:

IF( NEW.* IS DISTINCT FROM OLD.* ) THEN ...

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Daniel Chiaramello 2008-12-01 16:14:22 [TSearch2] Chinese dictionary?
Previous Message Adrian Klaver 2008-12-01 15:55:37 Re: Detecting changes to certain fields in 'before update' trigger functions