Re: triggers problems whit function

From: "Fernando Moreno" <azazel(dot)7(at)gmail(dot)com>
To: Ma(dot) Cristina Peña C(dot) <mpena(at)sensacd(dot)com(dot)mx>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: triggers problems whit function
Date: 2008-10-22 20:59:00
Message-ID: b1c45530810221359x2ef7887do6dd12b3719f0acb3@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2008/10/22 Ma. Cristina Peña C. <mpena(at)sensacd(dot)com(dot)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 and
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.

Cheers.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message MOLINA BRAVO FELIPE DE JESUS 2008-10-22 21:15:43 Re: triggers problems whit function
Previous Message Alexander Kuprijanov 2008-10-22 20:05:01 how to split coordinates from point