PostgreSQL Error Reference

Every error, explained

SQLSTATE codes, condition names, root causes, diagnostic queries, and recovery steps — structured for engineers running PostgreSQL in production.

578 errors documentedFree diagnostics on every pageAll PG versions covered

Showing 216 of 578 errors

23503 ERROR

Foreign Key Violation — SQLSTATE 23503

foreign_key_violation

A row references a parent key that does not exist, or a referenced parent is being deleted while children remain.

Integrity Constraint Violation
23503 ERROR

update or delete on table “…” violates foreign key constraint “…” on table “…” — 23503

foreign_key_violation

PostgreSQL error "update or delete on table "…" violates foreign key constraint "…" on table "…"" (SQLSTATE 23503): what it means, common causes, and ho...

Integrity Constraint Violation
23503 ERROR

update or delete on table “…” violates foreign key constraint (restrict) — 23503

foreign_key_violation

PostgreSQL error "update or delete on table … violates foreign key constraint (restrict) — 23503" (SQLSTATE 23503): what it means, common causes, and how to fix it.

Integrity Constraint Violation
23505 ERROR

duplicate key value violates unique constraint “…” — 23505

unique_violation

PostgreSQL error "duplicate key value violates unique constraint "…"" (SQLSTATE 23505): what it means, common causes, and how to fix it.

Integrity Constraint Violation
23505 ERROR

Unique Violation — SQLSTATE 23505

unique_violation

A row violates a UNIQUE constraint or unique index — the key already exists.

Integrity Constraint Violation
23514 ERROR

new row for relation “…” violates check constraint “…” — 23514

check_violation

PostgreSQL error "new row for relation "…" violates check constraint "…"" (SQLSTATE 23514): what it means, common causes, and how to fix it.

Integrity Constraint Violation
23514 ERROR

Check Violation — SQLSTATE 23514

check_violation

A row failed a CHECK constraint.

Integrity Constraint Violation
23P01 ERROR

Exclusion Violation — SQLSTATE 23P01

exclusion_violation

A row conflicts with an EXCLUDE constraint.

Integrity Constraint Violation
23P01 ERROR

conflicting key value violates exclusion constraint “…” — 23P01

exclusion_violation

PostgreSQL error "conflicting key value violates exclusion constraint "…"" (SQLSTATE 23P01): what it means, common causes, and how to fix it.

Integrity Constraint Violation
24000 ERROR

Invalid Cursor State — SQLSTATE 24000

invalid_cursor_state

SQLSTATE 24000 (invalid_cursor_state): A cursor was used in an invalid state.

Invalid Cursor State
25000 ERROR

Invalid Transaction State — SQLSTATE 25000

invalid_transaction_state

SQLSTATE 25000 (invalid_transaction_state): A command is not valid in the current transaction state.

Invalid Transaction State
25001 ERROR

SET TRANSACTION ISOLATION LEVEL must be called before any query — 25001

active_sql_transaction

PostgreSQL error "SET TRANSACTION ISOLATION LEVEL must be called before any query" (SQLSTATE 25001): what it means, common causes, and how to fix it.

Invalid Transaction State
25001 ERROR

CREATE INDEX CONCURRENTLY cannot run inside a transaction block — 25001

active_sql_transaction

PostgreSQL error "CREATE INDEX CONCURRENTLY cannot run inside a transaction block" (SQLSTATE 25001): what it means, common causes, and how to fix it.

Invalid Transaction State
25001 ERROR

REINDEX CONCURRENTLY cannot run inside a transaction block — 25001

active_sql_transaction

PostgreSQL error "REINDEX CONCURRENTLY cannot run inside a transaction block" (SQLSTATE 25001): what it means, common causes, and how to fix it.

Invalid Transaction State
25001 ERROR

DROP DATABASE cannot run inside a transaction block — 25001

active_sql_transaction

PostgreSQL error "DROP DATABASE cannot run inside a transaction block" (SQLSTATE 25001): what it means, common causes, and how to fix it.

Invalid Transaction State
25001 ERROR

CREATE DATABASE cannot run inside a transaction block — 25001

active_sql_transaction

PostgreSQL error "CREATE DATABASE cannot run inside a transaction block" (SQLSTATE 25001): what it means, common causes, and how to fix it.

Invalid Transaction State
25001 ERROR

VACUUM cannot run inside a transaction block — 25001

active_sql_transaction

PostgreSQL error "VACUUM cannot run inside a transaction block" (SQLSTATE 25001): what it means, common causes, and how to fix it.

Invalid Transaction State
25001 ERROR

Active Sql Transaction — SQLSTATE 25001

active_sql_transaction

A command was run that is not allowed inside a transaction block.

Invalid Transaction State
25002 ERROR

Branch Transaction Already Active — SQLSTATE 25002

branch_transaction_already_active

SQLSTATE 25002 (branch_transaction_already_active): A command is not valid in the current transaction state.

Invalid Transaction State
25003 ERROR

Inappropriate Access Mode For Branch Transaction — SQLSTATE 25003

inappropriate_access_mode_for_branch_transaction

SQLSTATE 25003 (inappropriate_access_mode_for_branch_transaction): A command is not valid in the current transaction state.

Invalid Transaction State
25004 ERROR

Inappropriate Isolation Level For Branch Transaction — SQLSTATE 25004

inappropriate_isolation_level_for_branch_transaction

SQLSTATE 25004 (inappropriate_isolation_level_for_branch_transaction): A command is not valid in the current transaction state.

Invalid Transaction State
25005 ERROR

No Active Sql Transaction For Branch Transaction — SQLSTATE 25005

no_active_sql_transaction_for_branch_transaction

SQLSTATE 25005 (no_active_sql_transaction_for_branch_transaction): A command is not valid in the current transaction state.

Invalid Transaction State
25006 ERROR

cannot execute … in a read-only transaction — 25006

read_only_sql_transaction

PostgreSQL error "cannot execute … in a read-only transaction — 25006" (SQLSTATE 25006): what it means, common causes, and how to fix it.

Invalid Transaction State
25006 ERROR

cannot execute … in a read-only transaction — 25006

read_only_sql_transaction

PostgreSQL error "cannot execute … in a read-only transaction" (SQLSTATE 25006): what it means, common causes, and how to fix it.

Invalid Transaction State