From: | Ivan Voras <ivoras(at)freebsd(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Session variables and C functions |
Date: | 2011-11-18 00:08:08 |
Message-ID: | CAF-QHFUEWeZnJ9kHsqpCxHzNeNAy9eR=u18tcSe+U72k-kx2SA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 17 November 2011 19:02, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Ivan Voras <ivoras(at)freebsd(dot)org> writes:
>> Ideally, the C module would create its own "custom variable class,"
>> named e.g. "module", then define some setting, e.g. "module.setting".
>> The users would then execute an SQL command such as "SET SESSION
>> module.setting='something'", and the module would need to pick this up
>> in the C function.
>
> Plenty of examples of that in contrib/ ...
Ok, I found DefineCustom*() and _PG_init() but there's a small
problem: the functions I'm writing are for a user defined typed and
apparently _PG_init() is not called until some operation with the type
is done (e.g. anything with the input/output functions).
This means that DefineCustom*() is not called and PG doesn't know
about the variable until it's too late - I need the session variable
to be settable by the user before input/output - relying on the
"default value" is not enough.
Is there any way to make _PG_init() called earlier, e.g. as soon as
the session is established or at database connection time, something
like that?
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-11-18 00:20:01 | Re: Session variables and C functions |
Previous Message | Raymond O'Donnell | 2011-11-17 23:58:47 | Re: Authentication configuration for local connections on Windows |