X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 51395D1B4C9 for ; Mon, 26 Jul 2004 15:52:27 -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 48785-10 for ; Mon, 26 Jul 2004 18:51:41 +0000 (GMT) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by svr1.postgresql.org (Postfix) with ESMTP id DDC6FD1B56B for ; Mon, 26 Jul 2004 15:50:59 -0300 (ADT) Received: from [65.34.209.198] (c-65-34-209-198.se.client2.attbi.com[65.34.209.198]) by comcast.net (sccrmhc11) with SMTP id <20040726185044011006gkjte>; Mon, 26 Jul 2004 18:50:48 +0000 User-Agent: Microsoft-Entourage/10.1.4.030702.0 Date: Mon, 26 Jul 2004 14:50:43 -0400 Subject: Re: How do I grant access to entire database at From: Randall Perry To: Cc: Message-ID: In-Reply-To: <1090183311.25749.98.camel@linda> Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200407/295 X-Sequence-Number: 14363 Thanks, I'll use it. But, if the developer's are listening -- this is really obtuse. MySQL administration is much easier. Please consider simplifying the GRANT process for future revs. BTW, I prefer postgresql for all my own development. on 7/18/04 4:41 PM, Oliver Elphick at olly@lfix.co.uk wrote: > On Sun, 2004-07-18 at 20:52, Randall Perry wrote: >> This is a pain. Couldn't we gave something simple like >> GRANT ALL ON database.* TO JOE; >> >> Which would grant full access to all objects in the database to JOE for all >> time? > > You can do it like this in psql: > > \a > \t > \o /tmp/grant.sql > SELECT 'GRANT ALL ON ' || n.nspname || '.' || c.relname || > ' TO joe;' > FROM pg_catalog.pg_class AS c > LEFT JOIN pg_catalog.pg_namespace AS n > ON n.oid = c.relnamespace > WHERE c.relkind IN ('r','v','S') AND > n.nspname NOT IN ('pg_catalog', 'pg_toast') AND > pg_catalog.pg_table_is_visible(c.oid) > ORDER BY n.nspname, c.relname; > \o > \i /tmp/grant.sql > > > The above could be put in a script and run from a Unix command prompt. > > (The SQL used above is adaated from that used by psql's \d command.) -- Randall Perry sysTame Xserve Web Hosting/Co-location Website Design/Development WebObjects Hosting Mac Consulting/Sales http://www.systame.com/