Received: from maia.hub.org (maia-4.hub.org [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 0CCBF63372C for ; Thu, 6 May 2010 18:13:54 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 11073-03 for ; Thu, 6 May 2010 21:13:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id A9B9C6329CB for ; Thu, 6 May 2010 18:13:46 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o46LDejF024220; Thu, 6 May 2010 17:13:40 -0400 (EDT) To: "Plugge, Joe R." cc: Justin Graf , "pgsql-sql@postgresql.org" Subject: Re: Column Specific Update Trigger Routine In-reply-to: References: =?utf-8?Q?_<4B54FDF3.4070601@gmx.net>_<92869e661001190627i4d42e3?= =?utf-8?Q?68nbb0e96bf5c54ca76@mail.gmail.com>__<4B55E22F.80409@gmx.net>?= =?utf-8?Q?_<65937bea1001192145u380846f3u30cc10d9d1784690@mail.gmail.com>__?= <4BE32DA4.3040209@magwerks.com> Comments: In-reply-to "Plugge, Joe R." message dated "Thu, 06 May 2010 16:02:52 -0500" Date: Thu, 06 May 2010 17:13:40 -0400 Message-ID: <24219.1273180420@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/28 X-Sequence-Number: 34076 "Plugge, Joe R." 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