pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rich Cullingford <rculling@sysd.com>
To: psql-interfaces@postgresql.org
Subject: Passing NEW to functions inside a trigger function...
Date: Mon, 19 Apr 2004 14:59:08 -0400
Message-ID: <4084217C.2040300@sysd.com> (raw)

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@sysd.com




Message-ID: <4084217C.2040300@sysd.com>
Permalink:  ../4084217C.2040300@sysd.com/
Also on:    postgresql.org/message-id/4084217C.2040300@sysd.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: rculling@sysd.com, psql-interfaces@postgresql.org
  Subject: Re: Passing NEW to functions inside a trigger function...
  In-Reply-To: <4084217C.2040300@sysd.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox