Re: triggers problems whit function

Поиск
Список
Период
Сортировка
От Guillaume Lelarge
Тема Re: triggers problems whit function
Дата
Msg-id 48FFA180.3080408@lelarge.info
обсуждение исходный текст
Ответ на Re: triggers problems whit function  ("Fernando Moreno" <azazel.7@gmail.com>)
Ответы Re: triggers problems whit function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Fernando Moreno a écrit :
> 2008/10/22 Ma. Cristina Peña C. <mpena@sensacd.com.mx
> <mailto:mpena@sensacd.com.mx>>
>
>     I want to use a function in to a trigger
>
>     This is my
>
>     CREATE FUNCTION "subradio"(integer) RETURNS integer AS 'select
>     cast(count (claveubica) as integer ) from asradios where ubicacion
>     =0;' LANGUAGE 'sql';
>
>     And my ttrigger is
>
>     CREATE TRIGGER validaradios AFTER DELETE ON subestacion FOR EACH ROW
>     EXECUTE PROCEDURE subradio(0);
>
>     But I got an error
>
>     ERROR:  CreateTrigger: function subradio() does not exist
>
>     What can I do??
>
> A trigger function must have a specific structure, it takes no arguments

It can take arguments.

> and returns "trigger".

And this is why, I think, the message tells "function subradio does not
exist". Because there's no subradio function that returns trigger.

> Besides, trigger functions are supposed to do
> some processing before or after insert, update or delete operations, so
> there's no sense in returning a row count.
>
> Take a look at the docs, specially chapter 35 and 38.9.
>

Regards.


--
Guillaume.
 http://www.postgresqlfr.org
 http://dalibo.com

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

Предыдущее
От: "Grzegorz Jaśkiewicz"
Дата:
Сообщение: join question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: join question