Re: Column Specific Update Trigger Routine

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Plugge, Joe R(dot)" <JRPlugge(at)west(dot)com>
Cc: Justin Graf <justin(at)magwerks(dot)com>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Column Specific Update Trigger Routine
Date: 2010-05-06 21:13:40
Message-ID: 24219.1273180420@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Plugge, Joe R." <JRPlugge(at)west(dot)com> writes:
> This is what I have and it seems to work:

> IF OLD.password != NEW.password

It'd be better to write "IF OLD.password IS DISTINCT FROM NEW.password".
The way with != will not do what you want if one value is null and the
other isn't. It's possible this doesn't matter in this particular case
(if password can't ever be null in this table), but being careful about
nulls is a good habit to cultivate.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Filip Rembiałkowski 2010-05-07 15:24:30 Re: help
Previous Message Plugge, Joe R. 2010-05-06 21:02:52 Re: Column Specific Update Trigger Routine