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 1o9Rvk-00023W-Kb for pgsql-general@arkaria.postgresql.org; Thu, 07 Jul 2022 13:52:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o9Rvj-0003hk-H5 for pgsql-general@arkaria.postgresql.org; Thu, 07 Jul 2022 13:52:31 +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 1o9Rvj-0003hb-6Z for pgsql-general@lists.postgresql.org; Thu, 07 Jul 2022 13:52:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o9Rvg-0004zu-Je for pgsql-general@lists.postgresql.org; Thu, 07 Jul 2022 13:52:30 +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 267DqQp92915673; Thu, 7 Jul 2022 09:52:26 -0400 From: Tom Lane To: Dominique Devienne cc: pgsql-general@lists.postgresql.org Subject: Re: About revoking large number of privileges; And the PUBLIC role. In-reply-to: References: Comments: In-reply-to Dominique Devienne message dated "Thu, 07 Jul 2022 09:47:38 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2915671.1657201946.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 07 Jul 2022 09:52:26 -0400 Message-ID: <2915672.1657201946@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Dominique Devienne writes: > Hi. I'm struggling to delete databases because of grants to roles on > objects of those DBs. > These DBs can have a large'ish number of schemas, 100-300 is typical. > and define a bunch of ROLEs "specific" to those schemas. Normally "login= user" > ROLEs are never granted explicit access to objects, instead only the > "db specific" ROLEs > get those grants, and regular users are granted some of those ROLEs. > So my goal is to delete all those "db specific" ROLEs, then the DB > with all its schemas. > Which implies REVOKE'ing grants on all those "db specific" ROLEs first. You should not really have to revoke those manually. The normal process for that is to use DROP OWNED BY. https://www.postgresql.org/docs/current/role-removal.html regards, tom lane