Re: Empty Updates, ON UPDATE triggers and Rules - Mailing list pgsql-general

From Josh Trutwin
Subject Re: Empty Updates, ON UPDATE triggers and Rules
Date
Msg-id 20090806140752.3b769783@sinkhole
Whole thread Raw
In response to Re: Empty Updates, ON UPDATE triggers and Rules  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
On Thu, 6 Aug 2009 13:15:57 -0400
Merlin Moncure <mmoncure@gmail.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

pgsql-general by date:

Previous
From: Bill Moran
Date:
Subject: Re: What happens when syslog gets blocked?
Next
From: Josh Trutwin
Date:
Subject: Re: Empty Updates, ON UPDATE triggers and Rules