X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1168BD1B1B0 for ; Tue, 15 Jun 2004 19:51:28 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18722-05 for ; Tue, 15 Jun 2004 22:51:28 +0000 (GMT) Received: from esri3.esri.com (dwp.esri.com [198.102.62.250]) by svr1.postgresql.org (Postfix) with ESMTP id 5C41AD1B196 for ; Tue, 15 Jun 2004 19:51:24 -0300 (ADT) Received: from zipwire.esri.com (zipwire.esri.com [46.1.2.224]) by esri3.esri.com (8.11.6+Sun/8.11.6) with ESMTP id i5FMpPH11351 for ; Tue, 15 Jun 2004 15:51:25 -0700 (PDT) Received: by zipwire.esri.com with Internet Mail Service (5.5.2657.72) id ; Tue, 15 Jun 2004 15:51:26 -0700 Message-ID: <491DC5F3D279CD4EB4B157DDD62237F401ADE49B@zipwire.esri.com> From: Brijesh Shrivastav To: "Pglibpq (E-mail)" Subject: Re: Filtering tables based on user privileges Date: Tue, 15 Jun 2004 15:51:26 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2657.72) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/40 X-Sequence-Number: 4968 After researching again I have come with following syntax to select all table with specific privilege (SELECT/INSERT/UPDATE..)to current user. SELECT relname FROM pg_class WHERE pg_table_is_visible(oid) AND relname !~ '^pg_' AND has_table_privilege (oid,'INSERT'); Is this the best way to do it? Is there any way to execute such a statement for any user? In this case such queries will most likely be executed by a super user. regards, Brijesh -----Original Message----- From: Brijesh Shrivastav [mailto:Bshrivastav@esri.com] Sent: Tuesday, June 15, 2004 9:58 AM To: Pglibpq (E-mail) Subject: [INTERFACES] Filtering tables based on user privileges Hi! I have a need to filter out tables that have specfic privileges for a user. For example, select all tables where user 'joe' has 'select' and 'insert' privileges. Can I somehow filter that at SQL level or will I have to get all non-system rows from pg_class and filter it one by one? How can I use whre clause against aclitem[] array? Regards, Brijesh Shrivastav ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)