way to pass NEW into function

Started by Mike Cianfloneover 24 years ago2 messages
#1Mike Cianflone
mcianflone@littlefeet-inc.com

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

#2Larry Rosenman
ler@lerctr.org
In reply to: Mike Cianflone (#1)
Re: way to pass NEW into function

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

Show quoted text

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