Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9F5D3632C51 for ; Sat, 28 Feb 2009 17:01:43 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 95643-03 for ; Sat, 28 Feb 2009 17:01:39 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from milkno.com (pfeiffer02.nmmn.net [217.114.78.33]) by mail.postgresql.org (Postfix) with ESMTP id 0E718632A32 for ; Sat, 28 Feb 2009 17:01:37 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by milkno.com (Postfix) with ESMTP id 2E3AC15CC0A2; Sat, 28 Feb 2009 22:01:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at milkno.com Received: from milkno.com ([127.0.0.1]) by localhost (localhost [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AH0InRDZfhbo; Sat, 28 Feb 2009 22:01:17 +0100 (CET) Received: from pptp-vpn1.office.nmmn.com (automatix.transfer.langbehn.hh.nmmn.net [217.114.64.90]) by milkno.com (Postfix) with ESMTPA id D90B315CC09B; Sat, 28 Feb 2009 22:01:16 +0100 (CET) Message-ID: <49A9A625.1040209@netzmeister-st-pauli.de> Date: Sat, 28 Feb 2009 22:01:25 +0100 From: Andreas Wenk User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: Tena Sakai CC: pgsql-admin@postgresql.org Subject: Re: grant question References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200902/269 X-Sequence-Number: 31490 Tena Sakai schrieb: > Thank you, Scott, for your reply. > > > Two problems. 1: you don't grant select on schemas, you grant it on > > tables. 2: case folding. If you're gonna use a name "schema_Z" then > > you have to quote it, because it's mixed case, not all lower. > > > You need to grant it for each table. > > In actual command issued, there is no case mixing. I wanted > to emphasize the argument was a schema name, not a table name. > But this means as new tables get created in the schema, a set > of new commands must be issued? > > > Note that instead of granting it to a user, you should grant it > > to a role, then give membership to that role to the user. > > That sounds like a good idea. Would you mind showing an exmple? Hi Tena, -- your user role roletest=# CREATE ROLE tena LOGIN; CREATE ROLE -- a group role roletest=# CREATE ROLE musicians; CREATE ROLE -- put tena 'in' the group role roletest=# GRANT musicians to tena; GRANT ROLE -- connect to roletest a user tena roletest=# \c roletest tena You are now connected to database "roletest" as user "tena". roletest=> select * from test; ERROR: permission denied for relation test STATEMENT: select * from test; ERROR: permission denied for relation test -- grant SELECT right as superuser in roletest roletest=> \c roletest postgres You are now connected to database "roletest" as user "postgres". roletest=# GRANT SELECT on test to musicians; GRANT roletest=# \c roletest tena You are now connected to database "roletest" as user "tena". roletest=> SELECT * FROM test; id | value ----+------- (0 rows) Cheers Andy -- St.Pauli - Hamburg - Germany Andreas Wenk > Regards, > > Tena Sakai > tsakai@gallo.ucsf.edu > > > -----Original Message----- > From: Scott Marlowe [mailto:scott.marlowe@gmail.com] > Sent: Sat 2/28/2009 12:04 PM > To: Tena Sakai > Cc: pgsql-admin@postgresql.org > Subject: Re: [ADMIN] grant question > > On Sat, Feb 28, 2009 at 12:56 PM, Tena Sakai wrote: > > Hi Everybody, > > > > I want to issue a command: > > > > grant select on schema_Z to user_a; > > > > so that the user_a can look at all tables in schema_Z. > > Sadly, what I get is: > > ERROR: relation "schema_Z" does not exist > > Two problems. 1: you don't grant select on schemas, you grant it on > tables. 2: case folding. If you're gonna use a name "schema_Z" then > you have to quote it, because it's mixed case, not all lower. > > > I tried: > > > > grant select on schema_Z.* to user_a; > > Sorry no wildcarding on grant (At least not yet). You need to grant > it for each table. Note that instead of granting it to a user, you > should grant it to a role, then give membership to that role to the > user. >