pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <joe.conway@mail.com>
To: pgsql-interfaces@postgresql.org
Subject: C function for use from PLpgSQL trigger
Date: Fri, 2 Feb 2001 11:57:51 -0800
Message-ID: <00f501c08d52$6dd1baf0$82d410ac@jecw2k1> (raw)

Hi,

I'm trying to create a C function that I can call from within a PLpgSQL
trigger function which will return a list of all the values in the NEW
record formatted suitably for an insert statement. I can't come up with a
way to do this directly from within PLpgSQL (i.e. iterate through an
arbitrary number of NEW.attribute).

Can anyone tell me how I can either pass the NEW record to the C function
(this produces an error message 'NEW used in a non-rule query') or gain
access to the trigger tuple from within my C function? It seems that
although PLpgSQL is called as a trigger, the C function is called as a
regular function (makes sense) and thus has no access to the trigger tuple
(my problem).

Any help or guidance is greatly appreciated!

Thanks,

Joe Conway




Message-ID: <00f501c08d52$6dd1baf0$82d410ac@jecw2k1>
Permalink:  ../00f501c08d52$6dd1baf0$82d410ac@jecw2k1/
Also on:    postgresql.org/message-id/00f501c08d52$6dd1baf0$82d410ac@jecw2k1

 · 

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: joe.conway@mail.com
  Subject: Re: C function for use from PLpgSQL trigger
  In-Reply-To: <00f501c08d52$6dd1baf0$82d410ac@jecw2k1>

* 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