Обсуждение: way to pass NEW into function

Поиск
Список
Период
Сортировка

way to pass NEW into function

От
Mike Cianflone
Дата:
    Is it possible to trick pg/sql to allow passing of the NEW record
into a function? I've got a trigger that gets kicked off before an insert
and I need to call another function and pass that record in, but doing a
perform activate_event(NEW); /* my function is activate_event(OPAQUE) */

only spits out "ERROR:  NEW used in non-rule query". Is there a way to trick
it into passing the NEW record into my function?

Thanks for any pointers,
Mike



Re: way to pass NEW into function

От
Larry Rosenman
Дата:
What I did in a similar trigger was set a variable (of type RECORD) to 
NEW and then use that. 

(I actually used the appropriate fields, but record should... work)

LER


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 7/10/01, 4:22:34 PM, Mike Cianflone <mcianflone@littlefeet-inc.com> 
wrote regarding [HACKERS] way to pass NEW into function:


>       Is it possible to trick pg/sql to allow passing of the NEW record
> into a function? I've got a trigger that gets kicked off before an insert
> and I need to call another function and pass that record in, but doing a
> perform activate_event(NEW); /* my function is activate_event(OPAQUE) */

> only spits out "ERROR:  NEW used in non-rule query". Is there a way to 
trick
> it into passing the NEW record into my function?

> Thanks for any pointers,
> Mike


> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org