Re: Application user name attribute on connection pool

From: Alex Hunsaker <badalex(at)gmail(dot)com>
To: rsmogura(at)softperience(dot)pl
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Application user name attribute on connection pool
Date: 2010-08-02 15:03:16
Message-ID: AANLkTin+T4ZWGzLGfLg+KDeuTiQeWQXbgsfYuqx2BySG@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Aug 2, 2010 at 07:30, <rsmogura(at)softperience(dot)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").

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jason Dixon 2010-08-02 16:04:42 Register now for Surge 2010
Previous Message Felipe de Jesús Molina Bravo 2010-08-02 14:35:42 solaris slow