Re: external function proposal for 7.2 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: external function proposal for 7.2
Date
Msg-id 8234.976684820@sss.pgh.pa.us
Whole thread Raw
In response to Re: external function proposal for 7.2  (mlw <markw@mohawksoft.com>)
List pgsql-hackers
mlw <markw@mohawksoft.com> writes:
> I just have to find where I call the exit function.

That will be the hard part.

FmgrInfo is not currently considered a durable data structure, and I
think you will be in for grief if you try to make any guarantees about
what will happen when one disappears.  If you need a cleanup proc to
be called, I'd suggest looking into registering it to be called at
query completion and/or transaction cleanup/abort, as needed.

Most of the sorts of resources you might need to clean up already have
cleanup mechanisms, so it's not entirely clear that you even *need*
a cleanup proc.  Maybe a different way to say that is that Postgres
already has a pretty well-defined cleanup philosophy, and it's geared
to particular resources (memory, open files, etc) not to individual
called functions.  You should consider swimming with that tide rather
than against it.

I have no objection to adding another field to FmgrInfo for the callee's
use, if you can show an example or two where it'd be useful.  I'm only
concerned about the callback-on-delete part.  That sounds like a recipe
for fragility...
        regards, tom lane


pgsql-hackers by date:

Previous
From: Horst Herb
Date:
Subject: Re: RFC: CRC datatype
Next
From: Tom Lane
Date:
Subject: Re: Re: COPY BINARY file format proposal