Re: [BUGS] Patch to allow C extension modules to initialize/finish

From: David Fetter <david(at)fetter(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: rse(at)engelschall(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUGS] Patch to allow C extension modules to initialize/finish
Date: 2006-08-03 21:37:12
Message-ID: 20060803213712.GA6829@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Thu, Aug 03, 2006 at 05:30:48PM -0400, Tom Lane wrote:
> "Ralf S. Engelschall" <rse(at)engelschall(dot)com> writes:
> > Hence I propose the patch below (applies to PostgreSQL 8.1.4)
> > which mimics the dlopen(3) and dlclose(3) behaviour of some Unix
> > platforms and resolves and calls _PG_init and _PG_fini functions
> > of an extension module right after/before the pg_dlopen/pg_dlclose
> > calls in the FMGR.
>
> This seems like a reasonably good idea, and we have got uses for at
> least the "init" case in most or all of our PLs. It's nominally too
> late for 8.2 feature freeze, but I said just a couple days ago that
> we shouldn't take a very hard line on that. Does anyone object to
> considering this for 8.2?

Nope :)

> 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? Both plpgsql and plperl seem to think they might need
> to make a distinction between things to do at library load time and
> things to do per-backend ... and yet, neither of them *actually*
> have anything they need to do per-backend.

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.

Cheers,
D
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
phone: +1 415 235 3778 AIM: dfetter666
Skype: davidfetter

Remember to vote!

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-08-03 21:51:37 Re: [BUGS] Patch to allow C extension modules to initialize/finish
Previous Message Tom Lane 2006-08-03 21:30:48 Re: [BUGS] Patch to allow C extension modules to initialize/finish

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-08-03 21:51:37 Re: [BUGS] Patch to allow C extension modules to initialize/finish
Previous Message Ron Mayer 2006-08-03 21:31:50 Re: O_NOATIME