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!
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.