Peter Eisentraut wrote:
> Mike Mascari writes:
>
>
>>Out of sheer shame for a stupid remark, I have implemented a pgenv
>>contrib module which provides three functions:
>>
>>set_session_variable (name, value)
>>get_session_variable (name)
>>reset_session_variables()
>
>
> How is this better than temporary tables?
Well, I basically implemented it as a result of this thread:
http://archives.postgresql.org/pgsql-general/2003-09/msg01347.php
But I can imagine people doing something like this:
Earlier:
--------
CREATE TABLE budgets (
deptid text not null,
budget numeric(16,2);
INSERT INTO budgets
VALUES ('Peter', 100000);
CREATE VIEW v_budgets AS
SELECT *
FROM budgets
WHERE deptid = get_session_variable('deptid');
Upon connecting:
---------------
SELECT set_session_variable('deptid', 'Peter');
SELECT *
FROM v_budgets;
I assume the PHP folks have other reasons as well. Although I'm not
sure...
Mike Mascari
mascarm@mascari.com