Re: is a user in a group?

From: Jie Liang <jliang(at)ipinc(dot)com>
To: Jacopo Silva <jsilva(at)lynxtesoft(dot)it>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: is a user in a group?
Date: 2000-11-10 17:58:38
Message-ID: 3A0C374E.DFB9FE65@ipinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

You need create a function use PLPGSQL(or PL/Perl) say:

ismember(groupname,username) return bool

since select grolist from pg_group where proname=groupname will return
you an array,
you can use a loop compare each element with the id from usesysid from
pg_user which match username.

Jacopo Silva wrote:

> I need to find out a quick way to check which groups a user
> is member of.
>
> In the pg_group table each group row has an array of
> userids of the members of the group.
> At the moment I am selecting all the rows than
> searching in each array for the id of the user
> I am looking for.
>
> There should be something more elegant than this!!!
> There should be a system table which I can use to find
> the relation between user and groups.
>
> I would be very grateful to anyone who can help me:-).
>
> Bye,
> Jacopo

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang(at)ipinc(dot)com
www.ipinc.com

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Fred.Zellinger 2000-11-10 22:48:43 table file size
Previous Message Peter Eisentraut 2000-11-10 16:29:26 Re: is a user in a group?