Re: Application user name attribute on connection pool - Mailing list pgsql-general

From Alex Hunsaker
Subject Re: Application user name attribute on connection pool
Date
Msg-id AANLkTin+T4ZWGzLGfLg+KDeuTiQeWQXbgsfYuqx2BySG@mail.gmail.com
Whole thread Raw
In response to Application user name attribute on connection pool  (<rsmogura@softperience.pl>)
List pgsql-general
On Mon, Aug 2, 2010 at 07:30,  <rsmogura@softperience.pl> wrote:
> Hello,
>
> I'm not member of this list, but because the 9th version of PostgreSQL is
> incoming, I would like to ask if there is possibility to add session
> property of application user

Not for 9.0 its more or less already cut.

> - this property, in contrast to login name,
> should be setted by driver (e.g. JDBC) to current user logged into
> application server. This for example, will allow triggers to store real
> user name in history tables or log subsystem (in future) to write who
> deleted this or that. Similarly solution is in Oracle.

You might be able to (ab)use the new application_name GUC, see
http://www.postgresql.org/docs/9.0/static/runtime-config-logging.html#GUC-APPLICATION-NAME.

I have used custom GUCS, per session temporary tables and giving each
user an actual database 'role' for this in the past.  Any of those
with appropriate triggers works fairly well.  I find normally you end
up needing a temp table anyways as you end up wanting to log more than
just the user (for me its the "page_load" or the "action").

pgsql-general by date:

Previous
From: Felipe de Jesús Molina Bravo
Date:
Subject: solaris slow
Next
From: Jason Dixon
Date:
Subject: Register now for Surge 2010