Re: RE: C function for use from PLpgSQL trigger - Mailing list pgsql-sql

From Joe Conway
Subject Re: RE: C function for use from PLpgSQL trigger
Date
Msg-id 00c301c08fa3$6edc0c90$c4d210ac@jecw2k1
Whole thread Raw
In response to RE: C function for use from PLpgSQL trigger  (Michael Davis <mdavis@sevainc.com>)
List 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






pgsql-sql by date:

Previous
From: Andrew Perrin
Date:
Subject: "Subclassing" in SQL
Next
From: ""
Date:
Subject: Packages to Install