Re: proposal : backend startup hook / after logon trigger

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: proposal : backend startup hook / after logon trigger
Date: 2011-11-26 15:21:48
Message-ID: 4ED1040C.4050306@fuzzy.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dne 25.11.2011 17:48, Tom Lane napsal(a):
> "Tomas Vondra" <tv(at)fuzzy(dot)cz> writes:
>> On 25 Listopad 2011, 2:44, Robert Haas wrote:
>>> I've thought of this before, but I'm not exactly clear on what the use
>>> cases are.
>
>> The startup hook is useful for initializing an extension written in C,
>> when the extension was loaded from postgresql.conf. If you need to perform
>> the initialization for each db separately (so that you can decide whether
>> to apply the extension to the user/database), you need to do that after
>> the backend starts.
>
> If you need that, just load the extension with local_preload_libraries.

I can't do that. I have an extension that needs to be loaded from
shared_preload_libraries (because it needs to ask for space in shared
memory segment), but I need to perform some additional initialization
for each backend.

Right now I solve that with an 'initialized' variable that's set to
false, and I have to check that before each action (and perform the init
if it's false). An after-startup hook would be much cleaner.

Tomas

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-11-26 15:45:26 Re: vpath builds and verbose error messages
Previous Message Andrew Dunstan 2011-11-26 14:51:30 Re: pgsql: Modify pg_dump to use error-free memory allocation macros. This