Обсуждение: how to obtain the user's group

Поиск
Список
Период
Сортировка

how to obtain the user's group

От
miguel angel rojas aquino
Дата:
hi, i'm looking for the way to obtain the group to which belongs a
database user, something like "SELECT USER" to obtain the current user
name but for the group. i'm looking in the documentation, but doesn't
seem to be something like this.

so, any help would be greatly appreciated, thanks and best regards.


Re: how to obtain the user's group

От
Bruno Wolff III
Дата:
On Tue, Jun 10, 2003 at 15:02:03 -0500,
  miguel angel rojas aquino <mrojas_aquino@mail.flashmail.com> wrote:
> hi, i'm looking for the way to obtain the group to which belongs a
> database user, something like "SELECT USER" to obtain the current user
> name but for the group. i'm looking in the documentation, but doesn't
> seem to be something like this.
>
> so, any help would be greatly appreciated, thanks and best regards.

The information you want is in pg_user and pg_group. Unfortunately
the list of user ids in a group are stored in an array which makes getting
the login names corresponding to those ids a bit of a pain or if you
are starting with a user finding which groups they are in. In 7.4
the array handling is going to be more powerful (but may still be a contrib)
which might make writing a simple query easy.