From DROP ROLE documentation, looks like a role cannot be removed if it is still referenced in somewhere in the database, so you would need to drop all the objects owned by that role using DROP OWNED
DROP OWNED does not exactly sound like it would revoke privileges granted to a role, but it does. As it also drops objects owned by the role, the safe sequence of commands to drop a role is:
REASSIGN OWNED BY rp_ts04 TO postgres; -- or some other trusted role
DROP OWNED BY rp_ts04;
It’s not either-or. Only DROP OWNED removes granted privileges.
Your error message points to privileges, not ownership. REASSIGN OWNED won’t fix that.
Run this in all databases of the same cluster where the role might own anything or have been granted privileges. Roles are shared between all databases in the same cluster. Then a final:
2
Answers
From DROP ROLE documentation, looks like a role cannot be removed if it is still referenced in somewhere in the database, so you would need to drop all the objects owned by that role using DROP OWNED
or re-asign them to other role using REASSIGN OWNED
DROP OWNED
does not exactly sound like it would revoke privileges granted to a role, but it does. As it also drops objects owned by the role, the safe sequence of commands to drop a role is:It’s not either-or. Only
DROP OWNED
removes granted privileges.Your error message points to privileges, not ownership.
REASSIGN OWNED
won’t fix that.Run this in all databases of the same cluster where the role might own anything or have been granted privileges. Roles are shared between all databases in the same cluster. Then a final:
See: