Re: user variables in session

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Igor Shevchenko <igor(at)carcass(dot)ath(dot)cx>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: user variables in session
Date: 2010-03-22 16:11:14
Message-ID: b42b73151003220911v7a7a2203s3db9ecf02ddb7ff5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 22, 2010 at 11:55 AM, Igor Shevchenko <igor(at)carcass(dot)ath(dot)cx> wrote:
> Hi All,
>
> I wasn't able to find any functions which would allow me to save/fetch/remove
> user variables local to pgsql session, e.g. -
>
> 1. select setvar('user variable name', 'user value');
> 2. select getvar('user variable name');
> 3. select delvar('user variable name');
>
> Is there any way to do this with stock PostgreSQL, or via something in
> contrib?
>
> Would pgsql's HTAB with hash_create and hash_search be a good basis for a
> simple C extension which would provide such feature ?

yes. this is trivially done and works. another way to do it with
pl/perl...there's an example in the docs iirc. personally, I prefer
the htab route. It's going to come down to which dependency you want
to deal with.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Greg Smith 2010-03-22 16:14:50 Re: strange
Previous Message Greg Smith 2010-03-22 16:06:34 Re: Reducing excess files in pg_xlog