Re: [BUGS] Patch to allow C extension modules to initialize/finish - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUGS] Patch to allow C extension modules to initialize/finish
Date
Msg-id 26751.1154641897@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUGS] Patch to allow C extension modules to initialize/finish  (David Fetter <david@fetter.org>)
Responses Re: [BUGS] Patch to allow C extension modules to initialize/finish
List pgsql-hackers
David Fetter <david@fetter.org> writes:
> On Thu, Aug 03, 2006 at 05:30:48PM -0400, Tom Lane wrote:
>> One question I have is whether it really works as expected in all
>> cases.  In particular what if the library is "preloaded" into the
>> postmaster?

> I'm not sure quite what you mean here, but PL/PerlU functions can
> use() modules, and those are called per-backend, i.e. when the
> function is invoked.  There's also some possibility that something
> might go into %_SHARED.

Well, the point is that you could have a scenario where the PG_init
function is executed in the postmaster, the process image is duplicated
via fork(), and then in a specific backend a LOAD command is executed
causing the PG_fini function to be called.  Is it likely that anything
would get confused by PG_init and PG_fini getting called by different
processes?

Also, if we do this we probably ought to remove the special-purpose
hack for preload_libraries to specify an init function --- it should
just happen by default.  Any objections to simplifying that?
        regards, tom lane


pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: [BUGS] Patch to allow C extension modules to initialize/finish
Next
From: Andrew Dunstan
Date:
Subject: Re: [BUGS] Patch to allow C extension modules to initialize/finish