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

From: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
To: John McCawley <nospam(at)hardgeus(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Any form of connection-level "session variable" ?
Date: 2007-01-05 01:53:09
Message-ID: C1C2FD95.5F0B6%scott_ribe@killerbytes.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.)

--
Scott Ribe
scott_ribe(at)killerbytes(dot)com
http://www.killerbytes.com/
(303) 722-0567 voice

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2007-01-05 02:22:29 Re: Any form of connection-level "session variable" ?
Previous Message nyenyec 2007-01-05 01:25:46 GUI tool that can reverse engineering schemas