X-Original-To: pgsql-admin@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A6721476386 for ; Thu, 24 Apr 2003 11:42:23 -0400 (EDT) Received: from mailgw1.syncinc.com (unknown [63.126.54.34]) by postgresql.org (Postfix) with ESMTP id 075A347637F for ; Thu, 24 Apr 2003 11:42:23 -0400 (EDT) Received: from ascwf14yqi3m2t (h000795bff979.ne.client2.attbi.com [24.62.106.235]) by mailgw1.syncinc.com (iPlanet Messaging Server 5.1 (built May 7 2001)) with ESMTPA id <0HDU00CMPU9JUR@mailgw1.syncinc.com> for pgsql-admin@postgresql.org; Thu, 24 Apr 2003 11:41:45 -0400 (EDT) Date: Thu, 24 Apr 2003 11:43:26 -0400 From: Michael Brusser Subject: Re: GRANT on all tables? In-reply-to: <1050499026.680723@kalvebod.groenjord.dk> To: dudsen , pgsql-admin@postgresql.org Reply-To: michael@synchronicity.com Message-id: MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal X-Spam-Status: No, hits=-18.7 required=5.0 tests=BAYES_01,IN_REP_TO,MSGID_GOOD_EXCHANGE,QUOTED_EMAIL_TEXT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/337 X-Sequence-Number: 8492 You can try something like this, just modify it for the language you use: set permission "SELECT" ;# update, all... lappend sql "SELECT 'grant $permission on ' || relname || ' to \"$username\" ;' from pg_class " lappend sql "WHERE relname not like 'pg_%' and relkind in ('r','v');" Now you have sql which, when executed, dynamically generates sql for granting desired permission for all tables and views. You may add 's' to the last clause to include sequences, if needed. You can run something like that in a single shot; for example you can execute sql with output redirected to a temp file, then include this file, or maybe come up with something more fancy to avoid using files at all. Hope it helps. Mike. > -----Original Message----- > From: pgsql-admin-owner@postgresql.org > [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of dudsen > Sent: Wednesday, April 16, 2003 9:17 AM > To: pgsql-admin@postgresql.org > Subject: [ADMIN] GRANT on all tables? > > > How do I GRANT an user privileges for all tables in an database with one > command, as it is now i need to specify the name of each table. > I want to write something like > GRANT SELECT,INSERT ON mydatabase TO user; this doesn't work but > are there a > way of getting someting similar to work? > > -- > Daniel Udsen > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html >