pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <jconway2@home.com>
To: pgsql-sql@postgresql.org
Subject: Fw: C function for use from PLpgSQL trigger
Date: Sun, 4 Feb 2001 00:04:00 -0800
Message-ID: <022101c08e81$088d0980$0705a8c0@jecw2k1> (raw)

Hello all,

I posted this (see below) Friday to the interfaces list with no response.
Does anyone know if what I'm trying to do is possible, or should I just
write the entire thing in a C function trigger? The latter would be
unfortunate because I think it would be nice to be able to extend PLpgSQL
using C functions like this.

Anyway, any help or advice will be much appreciated!

Thanks,

Joe

> 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
>




view thread (3+ messages)  latest in thread

Message-ID: <022101c08e81$088d0980$0705a8c0@jecw2k1>
Permalink:  ../022101c08e81$088d0980$0705a8c0@jecw2k1/
Also on:    postgresql.org/message-id/022101c08e81$088d0980$0705a8c0@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jconway2@home.com
  Subject: Re: Fw: C function for use from PLpgSQL trigger
  In-Reply-To: <022101c08e81$088d0980$0705a8c0@jecw2k1>
  References: <022101c08e81$088d0980$0705a8c0@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