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.
In response to
pgsql-novice by date
|Next:||From: Tom Lane||Date: 2005-04-25 15:57:08|
|Subject: Re: audit information |
|Previous:||From: Keith Worthington||Date: 2005-04-25 15:44:32|
|Subject: Re: audit information|