Grant each account only the permissions required for its tasks. In PostgreSQL, making databases and objects owned by a superuser encourages routine connections through an account that can bypass nearly every security check. section 8.4
The tempting ownership mistake
CREATE DATABASE frogge_next OWNER postgres; can turn the superuser into the practical owner and operator of an application database. A developer’s unprivileged account may then execute reset_schema(), a function created by the superuser with superuser execution rights. If that function drops every table, a production mistake can require restoration from backup, causing downtime and reputational damage. section 8.4
Apply the principle by:
- Avoid using the default postgres superuser for regular application connections and operations. section 8.4
- Separate development-only destructive capabilities from permissions available in production. section 8.4
CREATE DATABASE frogge_next OWNER postgres;
Inspect the superuser-owned database definition that creates the risky arrangement. section 8.4
















