42939
PostgreSQLERRORNotableSyntax Error or Access Rule ViolationHIGH confidence

reserved name

What this means

SQLSTATE 42939 is raised when an object is being created with a name that is reserved by the system — for example, trying to create a schema named "information_schema" or a table in the pg_catalog schema.

Why it happens
  1. 1Attempting to create an object with a name reserved for system use (e.g., pg_* schemas, information_schema)
  2. 2Trying to create a schema or table that conflicts with a system-reserved name
How to reproduce

Creating a table with a reserved system name.

trigger — this will error
trigger — this will error
CREATE TABLE pg_tables (id INT); -- reserved system name

expected output

ERROR:  unacceptable schema name "pg_tables"
DETAIL:  The prefix "pg_" is reserved for system schemas.

Fix

Choose a non-reserved name for the object

WHEN When a naming conflict with system objects is detected.

Choose a non-reserved name for the object
CREATE TABLE app_tables (id INT); -- non-reserved name

Why this works

Avoid names starting with pg_ (reserved for system use) and avoid names matching system catalogue views and schemas.

What not to do

Try to create objects in pg_catalog or information_schema

These schemas are reserved for Postgres system objects and cannot be modified.

Sources
Official documentation ↗

Class 42 — Syntax Error or Access Rule Violation

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All PostgreSQL errors