pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
passing new/old record in pl/pgsql trigger functions to other functions
2+ messages / 2 participants
[nested] [flat]

* passing new/old record in pl/pgsql trigger functions to other functions
@ 2004-05-31 05:51 basic <basic@mozdev.org>
  2004-05-31 06:14 ` Re: passing new/old record in pl/pgsql trigger functions to other functions Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: basic @ 2004-05-31 05:51 UTC (permalink / raw)
  To: pgsql-sql

Hi,
   In Postgresql version 7.4.1 How does one pass new/old record in a 
pl/pgsql trigger function to other functions? I tried to pass it 
directly but the select/perform statement caused an error saying "NEW 
used in query that is not in a rule". I've tried 'rename' in the declare 
block but that didn't work at all (I get 'invalid column', which I 
assume it means rename did not work at all). Besides copying the record 
columns one by one, is there any other way to do this?

--
basic



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: passing new/old record in pl/pgsql trigger functions to other functions
  2004-05-31 05:51 passing new/old record in pl/pgsql trigger functions to other functions basic <basic@mozdev.org>
@ 2004-05-31 06:14 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2004-05-31 06:14 UTC (permalink / raw)
  To: basic <basic@mozdev.org>; +Cc: pgsql-sql

basic <basic@mozdev.org> writes:
>    In Postgresql version 7.4.1 How does one pass new/old record in a 
> pl/pgsql trigger function to other functions?

You can't ... NEW and OLD are of unspecified-record types, and there's
no support for passing such things to other functions.  You pretty much
have to do the tedious "myfunc(NEW.f1, NEW.f2, ...)".

I've done some work recently to improve the support for passing record
types around as full-fledged datatypes.  The above still doesn't quite
work, and I can't promise that it'll get done for 7.5, but hopefully by
the release after that it will.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-05-31 06:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-05-31 05:51 passing new/old record in pl/pgsql trigger functions to other functions basic <basic@mozdev.org>
2004-05-31 06:14 ` Tom Lane <tgl@sss.pgh.pa.us>

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