Auditing with shared username

From: Eric E <whalesuit(at)bonbon(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Auditing with shared username
Date: 2004-12-06 16:58:20
Message-ID: 41B48FAC.10306@bonbon.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,
Like many folks who use three-tier design, I would like to create an
audit trail in my Postgres database, and I would like to do so without
having to create a database user for each audit.

As I see it, there are two ways to do this, and I can't see a clear way
to do either of them. If anyone has better suggestions, I'd of course
love to hear them.

Here's what I'd thought up:

1) Connect my homebrew login system which runs out of a couple database
tables to postgres connection/sessionID (i.e., keep track of which
sessionID represents my current user) so that any audit function can use
the session ID to look up the current user.

2) Maintain a "current homebrew user" session variable that is distinct
from Postgres' current_user, which I believe stores the current database
user. I found a couple threads on session variables, but mostly they
were discouraging people from using such variables.

Does anyone have any good ideas or advice?

Also, both of these methods require that a user maintain his/her own
session. I don't know how PG's connection pooling works, but is it
actually possible to specify a particular session for a particular
user? Is there some place I can find documentation on how Postgres
deals with logins and sessions?

Many thanks,

Eric

Browse pgsql-general by date

  From Date Subject
Next Message Ian Harding 2004-12-06 17:34:15 Re: Auditing with shared username
Previous Message Julian Scarfe 2004-12-06 16:50:17 Re: Index bloat in 7.2