Dropping a role seems to be a simple thing like:
DROP ROLE your_role
but it is not… In order to drop a role you need to ensure that there are no objects bound to this role.
How to unbind objects from a role?
Do it for every database!
What is really important while unbinding objects from a role is to DO IT FOR EVERY DATABASE.
Unbinding methods
Brute force version – DROP OWNED
You can use DROP OWNED if you don’t care about the bound objects – see https://www.postgresql.org/docs/current/sql-drop-owned.html
Revoke privileges
You can revoke each privilege one by one – https://www.postgresql.org/docs/current/sql-revoke.html.
Reassign privileges
You can also reassign privileges to another role – https://www.postgresql.org/docs/current/sql-reassign-owned.html.