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

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Any form of connection-level "session variable" ?
Дата
Msg-id 459DB665.2030009@joeconway.com
обсуждение исходный текст
Ответ на Re: Any form of connection-level "session variable" ?  (Scott Ribe <scott_ribe@killerbytes.com>)
Список pgsql-general
Scott Ribe wrote:
> What about:
>
>  create function set_emp_id() returns void as $$
>  begin
>     drop table if exists emp_1_id;
>     select emp_id into temp emp_1_id from secureview.tbl_employee where
> username = current_user;
>  end;
>  $$ language plpgsql;
>
>  create function get_emp_id() returns int as $$
>     return select emp_id from emp_1_id;
>  $$ language plpgsql stable;
>
> Call set_emp_id once on connection, then use get_emp_id thereafter. Would
> that be any faster? (This is what Erik meant by " a temp table is pretty
> much a session variable" in his earlier message.)

Or, in similar fashion, use this:
http://www.joeconway.com/sessfunc.tar.gz
http://www.onlamp.com/pub/a/onlamp/2004/06/28/postgresql_extensions.html

HTH,

Joe

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Ribe
Дата:
Сообщение: Re: Any form of connection-level "session variable" ?
Следующее
От: Michael Best
Дата:
Сообщение: Database Corruption - last chance recovery options?