Thread: How to get PGconn inside a user-defined C function?

How to get PGconn inside a user-defined C function?

From
James Cribb
Date:
I want to write a C function I can call from SQL that operates on a large
object, but the lo_*() functions all take a PGconn* as the first argument,
and that is not passed to user-defined functions.  How do I get the PGconn*
for the connection that is invoking the function?  (I can't afford to open a
new connection every time the function is called.)