Re: update trigger not working

Поиск
Список
Период
Сортировка
От Mike Nolan
Тема Re: update trigger not working
Дата
Msg-id 200510200250.j9K2oijO029318@gw.tssi.com
обсуждение исходный текст
Ответ на update trigger not working  (CSN <cool_screen_name90001@yahoo.com>)
Список pgsql-general
> 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.

Let me see if I have this right.

You have an 'after-update' trigger on a table that does an update on that
same table, and you're wondering why that creates an infinite loop?

You need to do this in a 'before-update' trigger and set NEW.timestamp,
then return NEW.
--
Mike Nolan



В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] Call for translators
Следующее
От: Oliver Elphick
Дата:
Сообщение: Re: update trigger not working