Skip site navigation (1) Skip section navigation (2)

Passing NEW to functions inside a trigger function...

From: Rich Cullingford <rculling(at)sysd(dot)com>
To: psql-interfaces(at)postgresql(dot)org
Subject: Passing NEW to functions inside a trigger function...
Date: 2004-04-19 18:59:08
Message-ID: 4084217C.2040300@sysd.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
All,
I'm unable to find this question addressed in the archive, tho' it seems 
rather obvious. One often needs to dispatch on different subsets of the 
data in NEW inside a PLPGSQL trigger function. It would be most 
convenient to just pass NEW itself (or NEW.*) to the function thus 
called, but there doesn't seem to be any way to do that. Any use of NEW 
inside a function call imbedded in the trigger function, whether in a 
SELECT INTO, EXECUTE or PERFORM, leads to a:

ERROR:  NEW used in query that is not in a rule

(or sometimes "relation NEW not found.")

I've seen syntax for passing a row of data in ordinary functions, but 
not inside triggers.

Any enlightenment appreciated!
                              Rich Cullingford
                              rculling(at)sysd(dot)com


pgsql-interfaces by date

Next:From: Brett SchwarzDate: 2004-04-19 20:02:32
Subject: Re: [HACKERS] Why is libpgtcl still in CVS?
Previous:From: Bruce MomjianDate: 2004-04-19 17:46:38
Subject: Re: [HACKERS] Why is libpgtcl still in CVS?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group