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: | 20050425154447.M75070@narrowpathinc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
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
> http://www.fuhr.org/~mfuhr/
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,
Keith
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-04-25 15:57:08 | Re: audit information |
Previous Message | Keith Worthington | 2005-04-25 15:44:32 | Re: audit information |