X-Original-To: pgsql-admin@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 71B3B474E4F for ; Thu, 13 Feb 2003 22:51:38 -0500 (EST) Received: from ns3.biznetindia.com (unknown [203.200.89.83]) by postgresql.org (Postfix) with ESMTP id 6FA3B474E42 for ; Thu, 13 Feb 2003 22:51:35 -0500 (EST) Received: from mail.linux-delhi.org ([203.145.144.115]) by ns3.biznetindia.com (8.12.5/8.12.5) with ESMTP id h1E3pMhL019202 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK) for ; Fri, 14 Feb 2003 09:21:35 +0530 Received: from mail.linux-delhi.org (localhost [127.0.0.1]) by mail.linux-delhi.org (8.12.5/8.12.5) with ESMTP id h1E3pJXb004420 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Fri, 14 Feb 2003 09:21:19 +0530 Received: (from raju@localhost) by mail.linux-delhi.org (8.12.5/8.12.5/Submit) id h1E3pIT7004416; Fri, 14 Feb 2003 09:21:18 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15948.26546.900701.127373@mail.linux-delhi.org> Date: Fri, 14 Feb 2003 09:21:14 +0530 To: pgsql-admin@postgresql.org Subject: Users and groups X-Mailer: VM 7.07 under 21.4 (patch 8) "Honest Recruiter" XEmacs Lucid From: Raj Mathur X-Spam-Status: No, hits=0.8 required=5.0 tests=SPAM_PHRASE_00_01 version=2.43 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/213 X-Sequence-Number: 7411 Hi, Using PostgreSQL 7.2.3 on a Linux box and facing some minor issues with determining which groups users belong to. I have created a PgSQL group called `administrators'. Now when I need to check whether user X is a member of that group, I use the contrib/array_iterator operator to do something like, select groname from pg_group where grolist **= ( select usesysid from pg_user where usename = 'X' ) ; This works just fine. However, the complementary process, determining all the users in group administrators, isn't so clean. Currently I'm brute-forcing it, getting each user in turn and then checking whether she belongs to group administrators using the construct above. Is there a simpler way? Also, are there any caveats attached to using the pg_ system tables directly? I prefer to do that to prevent duplication of user status: let PgSQL store whether the user is an administrator or not rather than have another table keeping that information. However, I'd change that if the structure of the pg_ tables is subject to change from time to time. Regards, -- Raju -- Raj Mathur raju@kandalaya.org http://kandalaya.org/ It is the mind that moves