Re: update trigger not working

From: Douglas McNaught <doug(at)mcnaught(dot)org>
To: CSN <cool_screen_name90001(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: update trigger not working
Date: 2005-10-20 02:53:18
Message-ID: m2wtk8ucf5.fsf@Douglas-McNaughts-Powerbook.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CSN <cool_screen_name90001(at)yahoo(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2005-10-20 03:19:02 Re: [pgsql-advocacy] Oracle buys Innobase
Previous Message Oliver Elphick 2005-10-20 02:52:33 Re: update trigger not working