Received: from tidal.ipinc.com (tidal.ipinc.com [199.245.188.85]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eAAI6ws38278 for ; Fri, 10 Nov 2000 13:06:58 -0500 (EST) (envelope-from jliang@ipinc.com) Received: from ipinc.com (jliang.ipinc.com [199.245.188.130]) by tidal.ipinc.com (8.9.3/8.9.3) with ESMTP id KAA08249; Fri, 10 Nov 2000 10:05:36 -0800 (PST) (envelope-from jliang@ipinc.com) Message-ID: <3A0C374E.DFB9FE65@ipinc.com> Date: Fri, 10 Nov 2000 09:58:38 -0800 From: Jie Liang Organization: ipinc.com X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 3.4-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Jacopo Silva CC: pgsql-admin@postgresql.org Subject: Re: is a user in a group? References: <002e01c04b22$89e177c0$3d01a8c0@sede.lynxtesoft.it> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200011/73 X-Sequence-Number: 82 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