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

User Context Variables

From: Shawn Garbett <shawn_garbett(at)yahoo(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: User Context Variables
Date: 2005-07-15 21:46:13
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
I need to trap some audit information in PostgreSQL.
Currently we have it working Oracle and it stores the
authenticated user in the sys_context so that a
trigger just does a "select userenv('client_info')
from dual;" and all the necessary magic is handled.
The reasons for this are complex, it involves
connection pooling, detached web sessions, etc. It's a
very elegant solution when using Oracle.

I'm having trouble figuring out how to do it in
PostgreSQL. So what I need is a way to save a single
value in a connection for a set of triggers to use
that is only valid during a transaction. A place to
store a user variable like sys context would work, a
temporary table would work, or some mysterious
function that did the equivalent would work. I can't
figure out if these are possible under PostgreSQL. 


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 


pgsql-novice by date

Next:From: Jaime CasanovaDate: 2005-07-15 22:19:01
Subject: Re: plpgsql trigger problem
Previous:From: Bruno Wolff IIIDate: 2005-07-15 17:03:48
Subject: Re: Backups

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