X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2DB7CD1C50C for ; Fri, 1 Aug 2003 21:13:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 72140-04 for ; Fri, 1 Aug 2003 18:12:38 -0300 (ADT) Received: from webmail.fhcrc.org (webmail.fhcrc.org [140.107.42.35]) by svr1.postgresql.org (Postfix) with ESMTP id B3624D1C4DB for ; Fri, 1 Aug 2003 18:13:42 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by webmail.fhcrc.org (8.11.6/8.11.6) with ESMTP id h71LDh211038; Fri, 1 Aug 2003 14:13:43 -0700 Received: from 140.107.62.154 ( [140.107.62.154]) as user sforteln@hydra.fhcrc.org by webmail.fhcrc.org with HTTP; Fri, 1 Aug 2003 14:13:43 -0700 Message-ID: <1059772423.3f2ad807a4e41@webmail.fhcrc.org> Date: Fri, 1 Aug 2003 14:13:43 -0700 From: sforteln@fhcrc.org To: MaRcElO PeReIrA Cc: pgsql-admin@postgresql.org Subject: Re: Grant on several tables at once References: <3F2AC832.7090803@yahoo.com.br> In-Reply-To: <3F2AC832.7090803@yahoo.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.0 X-Originating-IP: 140.107.62.154 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/34 X-Sequence-Number: 9757 Marcelo, Something like this should work to grant rights on all non system tables psql -t -A -U $DBOWNER -c "select tablename from pg_tables where tablename not like 'pg_%'" $DB_NAME | xargs -i ./psql -t -A -U $DBOWNER -c "grant ALL on {} to $USER" $DB_NAME Quoting MaRcElO PeReIrA : > Hello All, > > I have a database that contain 72 tables. How can I grant "SELECT" on > all those 72 tables to a user, at once? > > I use to do: > > # grant select on table1 to marcelo; > # grant select on table2 to marcelo; > # ... > # grant select on table72 to marcelo; > > but it is a lot of tables... I would like to do this at once! > > Thanks in advance and > Best Regards, > > Marcelo > > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings >