pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joe Conway <joe.conway@mail.com>
To: mdavis@sevainc.com
To: pgsql-sql@postgresql.org
Subject: Re: RE: C function for use from PLpgSQL trigger
Date: Mon, 5 Feb 2001 10:42:45 -0800
Message-ID: <00c301c08fa3$6edc0c90$c4d210ac@jecw2k1> (raw)
References: <01C08F4D.A9B6D800.mdavis@sevainc.com>

> You could send the column name directly into your c function.  For
example:
> c_function_name(NEW.col1, NEW.col2, NEW.col3).  Otherwise I am not sure
how
> to send NEW into a C function.  You could try declaring NEW in your C
> function as a tuple.

Thanks for your reply. I was hoping that I could avoid hardcoding NEW.col1,
etc, so that the function could be used for multiple relations. I've also
tried to declare the input parameter to the function as a tuple, but PLpgSQL
never gets that far -- it doesn't seem to support passing NEW as a
parameter.

Oh, well. I will probably just write all of my logic into a C function and
skip PLpgSQL entirely. That's too bad because it would be far simpler (and
preferrable IMHO) to write a generic trigger function in PLpgSQL and call C
functions for only certain operations that PLpgSQL does not directly
support.

Joe







view thread (3+ messages)

Message-ID: <00c301c08fa3$6edc0c90$c4d210ac@jecw2k1>
Permalink:  ../00c301c08fa3$6edc0c90$c4d210ac@jecw2k1/
Also on:    postgresql.org/message-id/00c301c08fa3$6edc0c90$c4d210ac@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: joe.conway@mail.com, mdavis@sevainc.com
  Subject: Re: C function for use from PLpgSQL trigger
  In-Reply-To: <00c301c08fa3$6edc0c90$c4d210ac@jecw2k1>
  References: <01C08F4D.A9B6D800.mdavis@sevainc.com> <00c301c08fa3$6edc0c90$c4d210ac@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