pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Plugge, Joe R. <JRPlugge@west.com>
Cc: Justin Graf <justin@magwerks.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: Column Specific Update Trigger Routine
Date: Thu, 06 May 2010 17:13:40 -0400
Message-ID: <24219.1273180420@sss.pgh.pa.us> (raw)
In-Reply-To: <BD69807DAE0CE44CA00A8338D0FDD08302D2654164@oma00cexmbx03.corp.westworlds.com>
References: <4B54FDF3.4070601@gmx.net>
	<92869e661001190627i4d42e3?= =?utf-8?Q?68nbb0e96bf5c54ca76@mail.gmail.com>
	<4B55E22F.80409@gmx.net>
	<65937bea1001192145u380846f3u30cc10d9d1784690@mail.gmail.com>
	<?= =?utf-8?Q?65937bea1001192223o2a443c3dw9148352fc2bb76d4@mail.gmail.com>
	<BD?= =?utf-8?Q?69807DAE0CE44CA00A8338D0FDD08302D2654129@oma00cexmbx03.corp.westwo?= =?utf-8?Q?rlds.com>
	<4BE32DA4.3040209@magwerks.com>
	<BD69807DAE0CE44CA00A8338D0FDD08302D2654164@oma00cexmbx03.corp.westworlds.com>

"Plugge, Joe R." <JRPlugge@west.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



view thread (5+ messages)

Message-ID: <24219.1273180420@sss.pgh.pa.us>
Permalink:  ../24219.1273180420@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24219.1273180420@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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, JRPlugge@west.com, justin@magwerks.com
  Subject: Re: Column Specific Update Trigger Routine
  In-Reply-To: <24219.1273180420@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