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 1jkIBs-0004mp-Gd for pgsql-general@arkaria.postgresql.org; Sun, 14 Jun 2020 02:16:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jkIBq-0006nX-9s for pgsql-general@arkaria.postgresql.org; Sun, 14 Jun 2020 02:16:06 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkIBq-0006nQ-1x for pgsql-general@lists.postgresql.org; Sun, 14 Jun 2020 02:16:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jkIBm-0006wL-A1 for pgsql-general@postgresql.org; Sun, 14 Jun 2020 02:16:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 05E2FuoF989794; Sat, 13 Jun 2020 22:15:56 -0400 From: Tom Lane To: sekhar chandra cc: Adrian Klaver , pgsql-general@postgresql.org Subject: Re: Fwd: not able to give usage access to public schema In-reply-to: References: Comments: In-reply-to sekhar chandra message dated "Sat, 13 Jun 2020 10:33:57 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <989792.1592100956.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 13 Jun 2020 22:15:56 -0400 Message-ID: <989793.1592100956@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 =3D 'role_test'; > rolname | has_schema_privilege > -----------+---------------------- > role_test | f This is verging on impossible to believe. To start with, in a standard 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=3D# create user role_test; CREATE ROLE regression=3D# 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=3D# table pg_namespace; oid | nspname | nspowner | nspacl = = -------+--------------------+----------+----------------------------------= --- ... 2200 | public | 10 | {postgres=3DUC/postgres,=3DUC/pos= tgres} ... That's what I get in a default installation. If I manually GRANT, it changes to 2200 | public | 10 | {postgres=3DUC/postgres,=3DUC/pos= tgres,role_test=3DU/postgres} What do you see? regards, tom lane