Re: select users in a group?

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: select users in a group?
Date: 2002-04-17 19:56:07
Message-ID: Pine.LNX.4.21.0204172050010.20382-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 17 Apr 2002, Johnson, Shaunn wrote:

> --WAIT ... I'm sorry ... by bad ...
>
> --I'm looking at the table pg_group and I see
> the group 'staff' listed ... along the lines, I see
> what I can only assume is the UID-ish numbers
> of the users that are in the group.
>
> --NOW ... I want to go from THAT point to figuring
> out who those people are ...
>
> --Hope I caught this in time ...
>
> -X
>
> -----Original Message-----
>
>
> Howdy:
>
> I'm running Postgres 7.1.3 on RedHat Linux 2.4.7-rel 10.
>
> How can I get a list of the users in a group? For example,
> I created a group called 'staff' ... I know there are five people
> in this group, but how can I *see* everyone in this group?
>
> Thanks!
>
> -X
>
>

Now, it's just a suggestion as I've not used arrays before but have you tried
something like:

SELECT u.usename FROM pg_user u WHERE EXISTS (SELECT 1 FROM pg_group g WHERE
g.grolist *= u.usesysid);

You should look up arrays in the documentation since I see from there that the
*= operator is probably an extension you need to install.

--
Nigel J. Andrews
Director

---
Logictree Systems Limited
Computer Consultants

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joe Conway 2002-04-17 19:57:55 Re: determining database size
Previous Message Jeff Davis 2002-04-17 19:39:43 determining database size