Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group