PostgreSQL 15+ ERROR 42501: permission denied for schema public

PostgreSQL 15 revoked `CREATE` on `public` schema from `PUBLIC` by default.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: PostgreSQL 15+ ERROR 42501 Platform: PostgreSQL
Common Root Causes:
  • PostgreSQL 15 revoked `CREATE` on `public` schema from `PUBLIC` by default.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Grant explicit privileges (`GRANT CREATE, USAGE ON SCHEMA public TO <app_role>;`) or use a dedicated schema.
Safe Diagnostic Command:
\dn+ public
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

PostgreSQL 15 revoked `CREATE` on `public` schema from `PUBLIC` by default. Recommended diagnostic: `\dn+ public`. Remediation: Grant explicit privileges (`GRANT CREATE, USAGE ON SCHEMA public TO <app_role>;`) or use a dedicated schema.

Worked Examples

  • Run `\dn+ public` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-pg-42501-permission-denied-schema-public · Independently verified: 2026-11-25

Related Resources