2

I'm trying to understand if it's okay for me drop the "postgres" role, or at the least, remove it as the superuser. Thanks!

  • 2
    I don't think it's a good idea. Just make sure no one can log in using it. – a_horse_with_no_name Nov 8 at 16:38
  • @a_horse_with_no_name Noted. Thanks for the tip! – horsinaround Nov 8 at 17:56
5

I'm trying to understand if it's okay for me drop the "postgres" role, or at the least, remove it as the superuser.

Dropping the role owning the template databases and all the system tables of all databases is not possible. There is even a specific error for that, should you try to DROP ROLE postgres:

ERROR: cannot drop role postgres because it is required by the database system


It's technically possible to remove the superuser capability to postgres, but if there is no superuser left in the system, any administrative task that only a superuser can do will be out of reach, and that would be really inconvenient.

On the other hand, it's entirely reasonable to deny through pg_hba.conf the ability for the postgres role to connect remotely, and also to set and enforce a password for the postgres account even for local-only connections.

  • You're right, I do encounter that when trying. Is there some benefit to keeping the postgres role as a superuser? – horsinaround Nov 8 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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