Creating Functions & Triggers

Поиск
Список
Период
Сортировка
От Kevin Lohka
Тема Creating Functions & Triggers
Дата
Msg-id 96880EBE-7ABE-11D8-A9E9-000A95728606@aboutfacedata.ab.ca
обсуждение исходный текст
Ответы Re: Creating Functions & Triggers  ("V i s h a l Kashyap @ [Sai Hertz And Control Systems]" <sank89@sancharnet.in>)
Re: Creating Functions & Triggers  (Markus Bertheau <twanger@bluetwanger.de>)
Список pgsql-novice
Hello everyone, I'm new to creating functions & triggers on postgresql
and am having trouble creating a trigger to update a record with the
modification date and the current user.

My code is below, but doesn't work.  It hangs psql when I attempt to
modify the record.  The function and trigger are created successfully.

CREATE FUNCTION email_mod_date() RETURNS OPAQUE AS '
   BEGIN
         UPDATE email SET  m_date = current_date, m_by_user =
current_user
         WHERE id = NEW.id;

   RETURN NULL;
   END;
'LANGUAGE 'plpgsql';



CREATE TRIGGER email_mod_date
AFTER UPDATE
ON email
FOR EACH ROW
EXECUTE PROCEDURE email_mod_date();

Thanks for any help.

Kevin Lohka


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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: PostgreSQL 7.4.2 new tables [Stupid Query]
Следующее
От: "Robert Morgan"
Дата:
Сообщение: Re: connect from network PC