Re: 'Session local' variables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Nick Johnson" <arachnid(at)notdot(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: 'Session local' variables
Date: 2007-07-02 05:49:56
Message-ID: 23063.1183355396@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Nick Johnson" <arachnid(at)notdot(dot)net> writes:
> On 7/2/07, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> "Nick Johnson" <arachnid(at)notdot(dot)net> writes:
>>> I want to write a contrib module that exports a couple of functions
>>> that PLs (that don't natively support this) can use to set/get
>>> session-local variables.
>>
>> Um, why do you need to do anything? Don't current_setting() and
>> set_config() cover this?

> I thought those were supposed to be reserved for postgres's
> configuration options?

Oh, you meant arbitrary new variables. You can (ab)use
custom_variable_classes for that. I've also seen people do it
with plperl or pltcl, using those languages' inbuilt capacity
for process-lifetime variables. (Probably plpython can do it
too, but I'm mostly clueless wrt python.)

Anyway, there are multiple ways to do this with just a couple
lines of code, so I don't see a need for a contrib module.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2007-07-02 05:54:46 Re: assigning password from script
Previous Message Ashish Karalkar 2007-07-02 05:47:02 Re: assigning password from script