Re: Trigger from a function

Поиск
Список
Период
Сортировка
От Decibel!
Тема Re: Trigger from a function
Дата
Msg-id 290D84E7-AD9F-45A2-AC4C-F20DAF8238FE@decibel.org
обсуждение исходный текст
Ответ на Trigger from a function  ("dguevara" <dguevara@acceso.com.pe>)
Ответы Re: Trigger from a function  ("dguevara" <dguevara@acceso.com.pe>)
Список pgsql-admin
On Feb 18, 2008, at 10:29 AM, dguevara wrote:

> Hello all,
>
> I have a problem with a trigger which is executed when i make an
> UPDATE trought a simple query, but
> not when the UPDATE is made in a store procedure.
>
> Maybe i'm missing something in the declaration of the function and
> i would appreciate any help.
> T
> his is the function:
>
> CREATE OR REPLACE FUNCTION X
>   RETURNS SETOF void AS
> $BODY$
>
> begin
>   update A;
> end;
> $BODY$
>   LANGUAGE 'plpgsql' VOLATILE;
>
>
> The trigger:
>
> CREATE TRIGGER Y
>   BEFORE INSERT OR UPDATE
>   ON A
>   FOR EACH ROW
>   EXECUTE PROCEDURE Z;
>
> CREATE OR REPLACE FUNCTION Z
>   RETURNS "trigger" AS
> $BODY$
> begin
>      if (tg_op in ('INSERT', 'UPDATE', 'DELETE')) then
>         update A;
>      end if;
> $BODY$
>   LANGUAGE 'plpgsql' VOLATILE;

Can't help much with your fake example, but I am wondering why you
have a recursive trigger on A.
--
Decibel!, aka Jim C. Nasby, Database Architect  decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828



Вложения

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

Предыдущее
От: Decibel!
Дата:
Сообщение: Re: vaccuming very large table problem
Следующее
От: Decibel!
Дата:
Сообщение: Re: Table was deleted but it still been treated as not