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

Re: audit information

From: "Keith Worthington" <keithw(at)narrowpathinc(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: audit information
Date: 2005-04-25 15:49:03
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Mon, 25 Apr 2005 09:35:34 -0600, Michael Fuhr wrote
> On Mon, Apr 25, 2005 at 10:41:09AM -0400, Keith Worthington wrote:
> >
> > Is there a way to obtain the postgres user id or must I store
> > the output of session_user in the tables?
> You could grab usesysid from pg_user:
> SELECT usesysid FROM pg_user WHERE usename = session_user;
> You can convert the user ID back to the name with pg_get_userbyid():
> SELECT pg_get_userbyid(1);
> -- 
> Michael Fuhr

Hmmm, that is interesting.  I really expected someone to point out a
session_id function of some sort.  For symmetry if no other reason.

I suppose I could write my own function to do that but the code you provided
is simple enough that I am not convinced that there is a real benefit.

In most cases I will want to convert the user ID to the employee name.

Thanks for the post.

Kind Regards,

In response to

pgsql-novice by date

Next:From: Tom LaneDate: 2005-04-25 15:57:08
Subject: Re: audit information
Previous:From: Keith WorthingtonDate: 2005-04-25 15:44:32
Subject: Re: audit information

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