Re: Empty Updates, ON UPDATE triggers and Rules

From: Josh Trutwin <josh(at)trutwins(dot)homeip(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Empty Updates, ON UPDATE triggers and Rules
Date: 2009-08-06 19:07:52
Message-ID: 20090806140752.3b769783@sinkhole
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 6 Aug 2009 13:15:57 -0400
Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:

> CREATE OR REPLACE FUNCTION set_last_modified ()
> RETURNS TRIGGER
> AS $$
> BEGIN
> IF NEW != OLD THEN -- 8.4 syntax
> NEW.last_modified = NOW();
> END IF;
>
> RETURN NEW;
> END;
> $$ LANGUAGE PLPGSQL;

Thanks - I'll try this. Since using 8.3 sounds like I need to
replace above with:

IF old::text != new::text

?

I'll give it a go anyway....

Josh

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Josh Trutwin 2009-08-06 19:31:48 Re: Empty Updates, ON UPDATE triggers and Rules
Previous Message Bill Moran 2009-08-06 19:00:37 Re: What happens when syslog gets blocked?