passing new.* in trigger

Started by Alessandro Vincelliover 21 years ago2 messagesgeneral
Jump to latest
#1Alessandro Vincelli
a.vincelli@w4b.it

I must pass NEW row to function count_room(rowtype) as in this code, but
pgsql return "_ NEW used in query that is not in a rule".
I have a bad syntax or is impossible pass NEW.*?

thanks, Ale

_
CREATE OR REPLACE FUNCTION public.dr_aggiorna_consistenze()
RETURNS trigger AS
'
declare
room int;
BEGIN

SELECT INTO camere count_room(NEW.*) FROM NEW ;
NEW.camere = camere;
RETURN NEW;
END;
'
LANGUAGE 'plpgsql' VOLATILE;

--
-------------------------------
Alessandro Vincelli
W4B - web for business s.r.l.
Firenze
via Pellicceria 10 - 50123
E-mail: a.vincelli@w4b.it
tel: 055-2654270

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alessandro Vincelli (#1)
Re: passing new.* in trigger

Alessandro Vincelli <a.vincelli@w4b.it> writes:

I must pass NEW row to function count_room(rowtype) as in this code, but
pgsql return "_ NEW used in query that is not in a rule".
I have a bad syntax or is impossible pass NEW.*?

That will work in 8.0, but not before.

regards, tom lane