Re: update trigger not working - Mailing list pgsql-general

From Douglas McNaught
Subject Re: update trigger not working
Date
Msg-id m2wtk8ucf5.fsf@Douglas-McNaughts-Powerbook.local
Whole thread Raw
In response to update trigger not working  (CSN <cool_screen_name90001@yahoo.com>)
List pgsql-general
CSN <cool_screen_name90001@yahoo.com> writes:

> I'm trying to set up a trigger that simply updates a
> field's corresponding timestamp to now() whenever the
> field is updated. But it's not working. Trying to
> debug, I commented out the inner IF and END and the
> log seemed to indicate infinite recursion occurred. My
> next guess is that perhaps NULL's in OLD.stuff is
> causing the IF to behave other than what I expect.

Make it a BEFORE UPDATE trigger and just set NEW.stuff_ts to now(),
rather than doing another query inside the trigger function.

-Doug

pgsql-general by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: update trigger not working
Next
From: Tom Lane
Date:
Subject: Re: [pgsql-advocacy] Oracle buys Innobase