Re: Triggers on columns - Mailing list pgsql-hackers

From David Fetter
Subject Re: Triggers on columns
Date
Msg-id 20090907170538.GC27103@fetter.org
Whole thread Raw
In response to Re: Triggers on columns  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: Triggers on columns
List pgsql-hackers
On Mon, Sep 07, 2009 at 07:53:01PM +0900, Itagaki Takahiro wrote:
> However, to be honest, I think standard-compliant column trigger is
> useless... I'm thinking additional extension for triggers -- if we
> want to check modifications of actual values, it could be defined
> as:
> 
>     CREATE TRIGGER trig BEFORE UPDATE ON tbl FOR EACH ROW
>         WHEN (NEW.col <> OLD.col) EXECUTE PROCEDURE trigger_func();

That should probably read:

CREATE TRIGGER trig BEFORE UPDATE ON tbl FOR EACH ROW   WHEN (NEW.col IS DISTINCT FROM OLD.col) EXECUTE PROCEDURE
trigger_func();

Cheers,
David.
-- 
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Patch: update Bonjour support to the newer non-deprecated API
Next
From: Alvaro Herrera
Date:
Subject: Re: Patch: update Bonjour support to the newer non-deprecated API