Incident brief
Reserved schema name (pg_ prefix)
Schema names beginning with 'pg_' are reserved for system schemas; creating one raises this reserved-name error.
What lands in your log
ERROR: unacceptable schema name "pg_reports"
In 10 seconds
- What triggers it
- CREATE SCHEMA with a name that starts with 'pg_'.
- Fix
- Choose a schema name without the 'pg_' prefix.
- Proof
- Reproduced on PostgreSQL 18.4 → A CREATE SCHEMA reproduces SQLSTATE 42939; the 'pg_'-prefixed name is rejected with a DETAIL explaining the reservation.
Fix
What to do right now
Application-level steps for this error.
- Choose a schema name without the 'pg_' prefix.
- Namespace your schemas with an application-specific prefix instead.
-- Use a non-reserved schema name.
CREATE SCHEMA IF NOT EXISTS app_data;
SELECT nspname FROM pg_namespace WHERE nspname = 'app_data';For this error
See this error live on the server
Run these against the affected instance to confirm the diagnosis before you act.
Reserved schema name (pg_ prefix) is resolved from pg_namespace. Check exact spelling/ownership and avoid reserved pg_ prefixes.
Schema names and owners
List existing schemas, including whether the current role can create in them.
SELECT nspname AS schema_name, pg_get_userbyid(nspowner) AS owner,
has_schema_privilege(current_user, oid, 'CREATE') AS can_create
FROM pg_namespace
ORDER BY nspname;Why it happens
What PostgreSQL is telling you
The mechanism behind the error, grounded in the official manual, not paraphrased.
PostgreSQL 18 Documentation, Appendix A. PostgreSQL Error Codes (Table A.1, Class 42, Syntax Error or Access Rule Violation)
42939 → reserved_nameRead the full section on postgresql.org →
Creating a 'pg_'-prefixed schema
The 'pg_' prefix is reserved for system schemas, so CREATE SCHEMA pg_reports raises 'unacceptable schema name pg_reports'.The session continues normally
The reserved-prefix check failed outside a transaction, so the session moves on to its next statement with no cleanup.Reproduce & verify
A real, single-session PostgreSQL reproduction
A literal transcript of SQL run against a live PostgreSQL instance in an isolated lab. The commands below are exactly what was executed.
- 1CREATE SCHEMA with a name that starts with 'pg_'.
- 2PostgreSQL rejects the name because the 'pg_' prefix is reserved for system schemas.
- 3The statement aborts with SQLSTATE 42939.
A team tried to group system-style reports under a 'pg_reports' schema and hit the reserved-prefix rule.
-- The error is self-contained in one statement; no schema is required.
SELECT 'no schema needed' AS setup_note;CREATE SCHEMA pg_reports;SELECT 'ok' AS session_after_error;What PostgreSQL actually returned
setup_note
------------------
no schema needed
(1 row)ERROR: unacceptable schema name "pg_reports"
DETAIL: The prefix "pg_" is reserved for system schemas. session_after_error
---------------------
ok
(1 row)The schema is created once its name avoids the reserved prefix.
Without this
Before: the 'pg_' prefix is rejected
With this, tested
After: a plain name is accepted
- A second operational test: exact SQL, raw output, measured result, and engineer notes
Card required. Cancel before day 7 and you are not charged.
Connected
Everything this error touches
Every page this SQLSTATE connects to: the concept that explains it, the runbooks that fix it, the parameters you tune to prevent it, and the sibling errors it travels with. All real cross-references. Jump straight in, or open the full interactive map.
Related errors
Verification
- Last verified
- 2026-07-24 (isolated lab, PostgreSQL 18.4)
- Verification scope
- Verified against PostgreSQL 18.4 in an isolated lab environment
- Audit status
- reviewed
Went further?
Pro unlocks the second lab proof
Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.