Re: audit information

Поиск
Список
Период
Сортировка
От Keith Worthington
Тема Re: audit information
Дата
Msg-id 20050425154447.M75070@narrowpathinc.com
обсуждение исходный текст
Ответ на Re: audit information  (Michael Fuhr <mike@fuhr.org>)
Список 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

В списке pgsql-novice по дате отправления:

Предыдущее
От: "Keith Worthington"
Дата:
Сообщение: Re: audit information
Следующее
От: Tom Lane
Дата:
Сообщение: Re: audit information