update trigger not working

Поиск
Список
Период
Сортировка
От CSN
Тема update trigger not working
Дата
Msg-id 20051020022653.17177.qmail@web52906.mail.yahoo.com
обсуждение исходный текст
Ответы Re: update trigger not working  (Mike Nolan <nolan@gw.tssi.com>)
Re: update trigger not working  (Oliver Elphick <olly@lfix.co.uk>)
Re: update trigger not working  (Douglas McNaught <doug@mcnaught.org>)
Список 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.

Thanks for any help!
CSN



CREATE or REPLACE function update_ts() returns trigger
as $end$

BEGIN

IF (TG_OP='UPDATE') THEN

    IF (OLD.stuff != NEW.stuff) THEN
        UPDATE table1
            set stuff_ts=now()
            where id=NEW.id;
    END IF;

END IF;

RETURN NULL;

END;

$end$ language plpgsql;

CREATE TRIGGER update_ts AFTER UPDATE ON table1 FOR
EACH ROW EXECUTE PROCEDURE update_ts();





__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

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

Предыдущее
От: "J.Kuwamura"
Дата:
Сообщение: 'a ' = 'a ' by MySQL(Re: [pgsql-advocacy] Oracle buys Innobase)
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] Call for translators