Re: contrib mode - pgenv

From: Mike Mascari <mascarm(at)mascari(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: contrib mode - pgenv
Date: 2003-09-21 11:05:55
Message-ID: 3F6D8613.60700@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)mascari(dot)com

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Mike Mascari 2003-09-21 11:22:20 Re: contrib mode - pgenv
Previous Message Hiroshi Inoue 2003-09-21 11:04:43 Re: pgsql-server/src/backend catalog/index.c comma ...