I had a user/role that was a database owner;

  1. so I dropped first the database;
  2. I try dropping the user and I get the following error:

role 'user_name' cannot be dropped because some objects depend ot it DETAIL: privileges for schema public

This is very confusing for me;

The schema public is the default schema schema when a database is created.

By dropping the database, shouldn't schema and other objects related to database dropped ? Why this privileges error ?

I want not just a solution to fix it, but also to understand why.

I checked:

  • with \l to be sure the database was droped
  • \du to check role attributes(empty)
  • Are you sure there are no dependencies in the remaining databases? Commented Sep 12, 2018 at 10:42
  • yes, only the privileges are reported Commented Sep 12, 2018 at 11:02

1 Answer 1


PostgreSQL isn't MySQL. You can't drop databases or users without being attached to some database. Based on the error message, the database you are attached to in order to execute the DROP USER statement is the one whose public schema has privileges granted to the doomed user.

Schema grants are not attributes of a role, so don't show up in \du. To see them, you would use \dn+.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.