When trying to drop a user who owns some tables or other database objects, you get the following error, and the user is not dropped:
testdb=# drop user bob; ERROR: role "bob" cannot be dropped because some objects depend on it DETAIL: owner of table bobstable owner of sequence bobstable_id_seq
This recipe presents two solutions to this problem.
To modify users, you must either be a superuser or have the
The easiest solution to this problem is to refrain from dropping the user, and use the trick from a previous recipe to prevent the user from connecting:
pguser=# alter user bob nologin; ALTER ROLE
This has the added benefit of the original owner of the table ...