Re: RE: C function for use from PLpgSQL trigger

From: "Joe Conway" <joe(dot)conway(at)mail(dot)com>
To: <mdavis(at)sevainc(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: RE: C function for use from PLpgSQL trigger
Date: 2001-02-05 18:42:45
Message-ID: 00c301c08fa3$6edc0c90$c4d210ac@jecw2k1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-02-05 19:35:53 Re: HELP: Scarey pl/pgsql problem
Previous Message Albert REINER 2001-02-05 17:39:19 Re: How to modify type in table?