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 1mpHuA-0000yb-Ph for pgsql-general@arkaria.postgresql.org; Mon, 22 Nov 2021 22:35:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mpHu9-0000Ac-NT for pgsql-general@arkaria.postgresql.org; Mon, 22 Nov 2021 22:35:17 +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 1mpHu9-00008S-Cs for pgsql-general@lists.postgresql.org; Mon, 22 Nov 2021 22:35:17 +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 1mpHu7-0004rL-Ai for pgsql-general@lists.postgresql.org; Mon, 22 Nov 2021 22:35:16 +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 1AMMZDip4103978; Mon, 22 Nov 2021 17:35:13 -0500 From: Tom Lane To: AC Gomez cc: "pgsql-generallists.postgresql.org" Subject: Re: In-reply-to: References: Comments: In-reply-to AC Gomez message dated "Mon, 22 Nov 2021 17:21:12 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4103976.1637620513.1@sss.pgh.pa.us> Date: Mon, 22 Nov 2021 17:35:13 -0500 Message-ID: <4103977.1637620513@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk AC Gomez writes: > REASSIGN OWNED BY old_role TO masteruser; > DROP OWNED BY old_role; > DROP USER old_role; > The consensus online is that these are the steps to be taken to > successfully remove roles, yet we get this error below: > ERROR: role "old_role" cannot be dropped because some objects depend on it > DETAIL: privileges for database the_database 96 objects in database > the_database SQL state: 2BP01 > What is it that we could be missing here? You need to do the REASSIGN OWNED and DROP OWNED steps in each database of the cluster that old_role has any objects/privileges in. You might need a manual revoke on "the_database" too; I'm not sure if DROP OWNED does anything about DB-level privileges. regards, tom lane