Re: Any form of connection-level "session variable" ?

Поиск
Список
Период
Сортировка
Искать
От
ptjm@interlog.com (Patrick TJ McPhee)
Тема
Re: Any form of connection-level "session variable" ?
Дата
Msg-id
12prpgmn9b0926f@corp.supernews.com
Список
Дерево обсуждения
Any form of connection-level "session variable" ? John McCawley <nospam@hardgeus.com>
Re: Any form of connection-level "session variable" ? John McCawley <nospam@hardgeus.com>
Re: Any form of connection-level "session variable" ? Tom Lane <tgl@sss.pgh.pa.us>
Re: Any form of connection-level "session variable" ? Erik Jones <erik@myemma.com>
Re: Any form of connection-level "session variable" ? Tom Lane <tgl@sss.pgh.pa.us>
Re: Any form of connection-level "session variable" ? John McCawley <nospam@hardgeus.com>
Re: Any form of connection-level "session variable" ? Tom Lane <tgl@sss.pgh.pa.us>
Re: Any form of connection-level "session variable" ? John McCawley <nospam@hardgeus.com>
Re: Any form of connection-level "session variable" ? Scott Ribe <scott_ribe@killerbytes.com>
Re: Any form of connection-level "session variable" ? David Fetter <david@fetter.org>
Re: Any form of connection-level "session variable" ? Scott Ribe <scott_ribe@killerbytes.com>
Re: Any form of connection-level "session variable" ? Joe Conway <mail@joeconway.com>
In article <459D4FA0.4020202@hardgeus.com>,
John McCawley  wrote:

% Is there any way I could establish this ID initially in some sort of 
% connection-level variable, and from this point on reference that 
% variable?

We do this sort of thing using a custom C function, but I've been
thinking lately you could use a custom variable class to do the same
thing.

Put
 custom_variable_classes = 'session'

in your postgresql.conf, and you can have
 set session.myid = 23;

then retrieve the value either by joining to pg_settings or using
 show session.myid;

You can perform per-user initialisation with
 alter user set session.myid = 23;

Which allows the value to persist between sessions.

I haven't done anything with this idea so I can't say how well it
works or whether there are downsides to it.
-- 

Patrick TJ McPhee
North York  Canada
ptjm@interlog.com
В списке pgsql-general по дате отправления
От: Wilton
Дата:
Сообщение: Continue sequence
От: ptjm@interlog.com (Patrick TJ McPhee)
Дата:
FAQ