PostgreSQL · infra · fg-0274

'permission denied for schema public' when an app role runs migrations on PostgreSQL 15 or later

ERROR: permission denied for schema public

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

Cause

PostgreSQL 15 removed the default CREATE privilege for PUBLIC on the public schema in new clusters and new databases, and made pg_database_owner its owner. Upgraded clusters and restored dumps keep the old grants, so environments disagree.

Fix

Make the app role own the database, or grant CREATE on the schema to it explicitly.

Apply

ALTER DATABASE app OWNER TO app_user;
-- or
GRANT USAGE, CREATE ON SCHEMA public TO app_user;

Affects: PostgreSQL 15 and later (October 2022), new clusters and newly created databases

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp