Re: Drop role cascade ? - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Drop role cascade ?
Date
Msg-id 5eabfe58-0dfe-5438-fa3d-fc840c709bdd@aklaver.com
Whole thread Raw
In response to Drop role cascade ?  (David Gauthier <dfgpostgres@gmail.com>)
List pgsql-general
On 11/17/22 15:07, David Gauthier wrote:
> psql (11.5, server 11.3) on linux
> 
> Someone who had privileges in a lot of tables/schemas/DBs left the 
> company.  I want to drop that role but "rop role xxx" won't let me 
> because...  "xxx cannot be dropped because some objects depend on it".
> 
> Is there a way to just get rid of this role without revoking xxx in all 
> the individual DB objects he has privs too?  Something like "drop role 
> xxx cascade" ?

1) You might want to confirm that removing that role is not going to 
leave you a bind where the objects do not have the necessary privileges 
to complete their tasks.

2) From here :

https://www.postgresql.org/docs/current/sql-droprole.html

"A role cannot be removed if it is still referenced in any database of 
the cluster; an error will be raised if so. Before dropping the role, 
you must drop all the objects it owns (or reassign their ownership) and 
revoke any privileges the role has been granted on other objects. The 
REASSIGN OWNED and DROP OWNED commands can be useful for this purpose; 
see Section 22.4 for more discussion."

So you should take a look at:

https://www.postgresql.org/docs/current/sql-reassign-owned.html



-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: David Gauthier
Date:
Subject: Drop role cascade ?
Next
From: Tom Lane
Date:
Subject: Re: Drop role cascade ?