Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkIO7-00057v-EK for pgsql-general@arkaria.postgresql.org; Sun, 14 Jun 2020 02:28:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jkIO5-0005Rj-Eo for pgsql-general@arkaria.postgresql.org; Sun, 14 Jun 2020 02:28:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkIO3-0005Ra-Ln for pgsql-general@lists.postgresql.org; Sun, 14 Jun 2020 02:28:45 +0000 Received: from [64.147.123.21] (helo=wout5-smtp.messagingengine.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkINy-0000Bc-8L for pgsql-general@postgresql.org; Sun, 14 Jun 2020 02:28:42 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 71C444C4; Sat, 13 Jun 2020 22:28:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Sat, 13 Jun 2020 22:28:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=g 7J27Jt1ExFOwR1/Ups47Li/BkKWDdzsWG+m1I7yO3A=; b=gqRdh4Ekd5HxaD6bt OfIJPIp+7tk1esfXMWj3xL8rwBC6iSaG233yRj53pP57Cld8PaTFrSVZP2AEl/kX 7ZCl4lOM/OUW3zAaLIFvp0HtneuuVt2H6Slh/8P7G2Z4l4jrMUxyIczgthCGWiGA KfT5BK5zFZlFopFr/3Nyhv8MCrf0X8r9Q4/Cmxu5ovFYL+m8+0BNCSStzeyMIO4C 94FqknqWZ/hsP6QPLJwAwXa6H7fSpggz++iz76NXinQ73OeGvbHS0GSuCIgDszuw gwIhhMSDvPUaikqAuOIIaXedpMjbFi7Bk86PgLamO2F01APiTgtsoKPL2sUfegYw 26lcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=g7J27Jt1ExFOwR1/Ups47Li/BkKWDdzsWG+m1I7yO 3A=; b=rRR8snccDCE3Fw0Tg/b+JFAPMmtAJQGAEvXC0FE9leqz/PRWe78LMeeOv CuRnPqn+rlMTA6QLvsXyo9dbJIgSbMdD8oA87LQjP1G+mhDDDNsMVPgfHZ4Z0rf/ nvpwXVdN2L7QpNYRDQtQ+nVR2LCSNCmeUiTVD9y8EfY+cBbGuJt+AbD4f5/0EhYF L0aLhk2oSLLGGcuC64PSL/PpqusgbC57aGNZBESIY7tSscnhilS5JN23B/C2GqH1 mgSRhFHPbxyyaFUdt6ld3yrO0milHSlOdPQmodNl9PTVpHCSZ8dEfcb4E+oMU3FV Cvf5TZb+LXSBrFnoAHQ9H9njKUZOg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeigedgieduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepteejvdetff ejuedvleeifeefheeutdfhgfdvhffhhfekvdduveegvdejudefgfevnecukfhppeejhedr udejvddrhedrvdefudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id 5210D30618BF; Sat, 13 Jun 2020 22:28:25 -0400 (EDT) Subject: Re: Fwd: not able to give usage access to public schema To: Tom Lane , sekhar chandra Cc: pgsql-general@postgresql.org References: <989793.1592100956@sss.pgh.pa.us> From: Adrian Klaver Message-ID: <9b76e12f-8f78-4c67-1fbf-8bac20467293@aklaver.com> Date: Sat, 13 Jun 2020 19:28:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <989793.1592100956@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 64.147.123.21 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 6/13/20 7:15 PM, Tom Lane wrote: > sekhar chandra writes: >> Adrian - when I follow the same steps what you did . in my case , the >> result is false. > >> grant usage on schema public to role_test ; >> GRANT > >> SELECT rolname, has_schema_privilege('role_test', 'public', 'usage') >> from pg_roles where rolname = 'role_test'; >> rolname | has_schema_privilege >> -----------+---------------------- >> role_test | f > > This is verging on impossible to believe. To start with, in a standard I'm wrestling with the same thing. What also is in the file that Sekhar sent was the fact this is happening in an AWS Aurora instance. I've gone over the Aurora docs and can't see anything that says the behavior is different. Still it is another data point. > installation rights on the public schema are granted to PUBLIC, so that > any role should *already* have usage privilege as soon as it's created. > Thus: > > regression=# create user role_test; > CREATE ROLE > regression=# select has_schema_privilege('role_test', 'public', 'usage'); > has_schema_privilege > ---------------------- > t > (1 row) > > Even if you'd revoked that public grant, manually granting should > certainly have worked. So my thoughts are running towards maybe > you have created a nonstandard version of has_schema_privilege() > that doesn't do what you think. > > Anyway, I'd suggest removing some variables from the equation by > looking directly at the catalog: > > postgres=# table pg_namespace; > oid | nspname | nspowner | nspacl > -------+--------------------+----------+------------------------------------- > ... > 2200 | public | 10 | {postgres=UC/postgres,=UC/postgres} > ... > > That's what I get in a default installation. If I manually GRANT, it > changes to > > 2200 | public | 10 | {postgres=UC/postgres,=UC/postgres,role_test=U/postgres} > > What do you see? > > regards, tom lane > -- Adrian Klaver adrian.klaver@aklaver.com