Trigger Question

Поиск
Список
Период
Сортировка
От Jason Lee
Тема Trigger Question
Дата
Msg-id 551361601E50574FA29E3435C537A9AD028C919F@iec04.iecokc.com
обсуждение исходный текст
Ответы Re: Trigger Question  (Richard Huxton <dev@archonet.com>)
Re: Trigger Question  (Terry Lee Tucker <terry@leetuckert.net>)
Re: Trigger Question  (Alban Hertroys <alban@magproductions.nl>)
Список pgsql-general
I'm trying to write a trigger that updates a date_changed field on a record anytime that record is updated.  I have a function written, and the trigger created, but everytime I update the record, I get a recursion limit error.  It appears that the action performed by my trigger is causing the trigger to fire.  How do I avoid that.  For the record, here's my function (modeled after a trigger that works on SQL Server.  I'm pretty much a noob with plpgsql :)
 
declare begin 
    update unit_specification set date_changed = now() from unit_specification us where us.id = NEW.id;  
    RETURN NEW; 
end;
 
With the trigger created with
 
CREATE TRIGGER update_changed_ts AFTER INSERT OR UPDATE
   ON unit_specification FOR EACH ROW
   EXECUTE PROCEDURE public.update_unit_spec_changed_date();
Thanks for the help. :)
 
-----
Jason Lee, SCJP
Senior Software Engineer
 

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

Предыдущее
От: Jaime Silvela
Дата:
Сообщение: DST failing on 8.1.3
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: grant permissions to set variable?