PostgreSQL documented errors
Browse PostgreSQL error messages, error codes, troubleshooting explanations, and practical fixes with exact wording and search-friendly reference pages.
This PostgreSQL error reference is designed for users searching exact PostgreSQL error messages, error codes, and clear how-to-fix guidance.
PostgreSQL users often search exact error messages and error codes rather than general documentation topics, so this hub is written to support copied-message search as well as product browsing.
Each PostgreSQL entry focuses on what the error means, why it happens, and what to check next so the page is useful both from search engines and from internal navigation.
Authentication
Authentication errors
Connection Capacity
Connection Capacity errors
Data Integrity
Data Integrity errors
23502PostgreSQL 23502: null value violates a not-null constraintSQLSTATE 23502 is not_null_violation. A required column received SQL NULL, either explicitly or through the insert, update, or migration path. A default does not replace an explicitly supplied NULL. Diagnose how the value was produced before relaxing a requirement that other code relies on.
23503PostgreSQL 23503: foreign key constraint violationSQLSTATE 23503 is foreign_key_violation. A child row can reference a missing parent, or a parent update or deletion can break an existing reference. Read DETAIL to distinguish a key that is not present from one that is still referenced; the correct repair depends on that direction.
23505PostgreSQL 23505: duplicate key violates a unique constraintPostgreSQL rejected a write because its key conflicts with a unique index or constraint. SQLSTATE 23505 is unique_violation. The constraint name and DETAIL identify the conflicting key; the collision can involve an UPDATE, a composite key, or an indexed expression, not just a repeated primary-key INSERT.
23514PostgreSQL 23514: row violates a check constraintSQLSTATE 23514 is check_violation. The proposed row failed a CHECK expression, such as an allowed status, a positive amount, or an ordering rule between dates. The constraint name identifies the rule, but the failing value may depend on several columns or a transformation performed before storage.
Query Resolution
Query Resolution errors
42703PostgreSQL 42703: column does not existSQLSTATE 42703 is undefined_column. PostgreSQL cannot find a column reference in the current query scope. The underlying table may exist and contain data; the SQL might use the wrong spelling, identifier quoting, table alias, or a field that the deployed schema has not acquired yet.
42P01PostgreSQL 42P01: relation does not existSQLSTATE 42P01 is undefined_table. PostgreSQL cannot resolve a referenced relation in the current connection or query scope. A relation can be a table, view, or another table-like object. This does not prove that data was deleted: the database, schema, quoted name, or session may simply be different.
Transaction Concurrency
Transaction Concurrency errors
40001PostgreSQL 40001: could not serialize accessSQLSTATE 40001 is serialization_failure. PostgreSQL rejected a transaction to preserve the guarantees of Repeatable Read or Serializable isolation. Message wording can also mention read/write dependencies among transactions. A transient conflict is expected under concurrency, but the application must restart the complete transaction rather than continue with its old snapshot.
40P01PostgreSQL 40P01: deadlock detectedSQLSTATE 40P01 is deadlock_detected. Two or more transactions form a cycle: each holds a lock another needs. PostgreSQL aborts one participant so others can proceed. This is not simply a slow query or any lock wait, and the victim transaction is not necessarily the code that created the underlying ordering problem.