pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jie Liang <jliang@ipinc.com>
To: Jacopo Silva <jsilva@lynxtesoft.it>
Cc: pgsql-admin@postgresql.org
Subject: Re: is a user in a group?
Date: Fri, 10 Nov 2000 09:58:38 -0800
Message-ID: <3A0C374E.DFB9FE65@ipinc.com> (raw)
References: <002e01c04b22$89e177c0$3d01a8c0@sede.lynxtesoft.it>

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@ipinc.com
www.ipinc.com






view thread (4+ messages)  latest in thread

Message-ID: <3A0C374E.DFB9FE65@ipinc.com>
Permalink:  ../3A0C374E.DFB9FE65@ipinc.com/
Also on:    postgresql.org/message-id/3A0C374E.DFB9FE65@ipinc.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: jliang@ipinc.com, jsilva@lynxtesoft.it
  Subject: Re: is a user in a group?
  In-Reply-To: <3A0C374E.DFB9FE65@ipinc.com>
  References: <002e01c04b22$89e177c0$3d01a8c0@sede.lynxtesoft.it> <3A0C374E.DFB9FE65@ipinc.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox