Re: contrib mode - pgenv - Mailing list pgsql-patches

From Mike Mascari
Subject Re: contrib mode - pgenv
Date
Msg-id 3F6D8613.60700@mascari.com
Whole thread Raw
In response to Re: contrib mode - pgenv  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: contrib mode - pgenv
Re: contrib mode - pgenv
List pgsql-patches
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





pgsql-patches by date:

Previous
From: Manfred Spraul
Date:
Subject: Re: Align large shared memory allocations
Next
From: Mike Mascari
Date:
Subject: Re: contrib mode - pgenv