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 72 of 578 errors

0F000 ERROR

Locator Exception — SQLSTATE 0F000

locator_exception

SQLSTATE 0F000 (locator_exception): A large-object locator is invalid.

Locator Exception
0F001 ERROR

Invalid Locator Specification — SQLSTATE 0F001

invalid_locator_specification

SQLSTATE 0F001 (invalid_locator_specification): A large-object locator is invalid.

Locator Exception
0L000 ERROR

Invalid Grantor — SQLSTATE 0L000

invalid_grantor

SQLSTATE 0L000 (invalid_grantor): The grantor or grant operation is invalid.

Invalid Grantor
0LP01 ERROR

Invalid Grant Operation — SQLSTATE 0LP01

invalid_grant_operation

SQLSTATE 0LP01 (invalid_grant_operation): The grantor or grant operation is invalid.

Invalid Grantor
0P000 ERROR

Invalid Role Specification — SQLSTATE 0P000

invalid_role_specification

SQLSTATE 0P000 (invalid_role_specification): The role specification is invalid.

Invalid Role Specification
0Z000 ERROR

Diagnostics Exception — SQLSTATE 0Z000

diagnostics_exception

SQLSTATE 0Z000 (diagnostics_exception): Stacked diagnostics were accessed without an active handler.

Diagnostics Exception
0Z002 ERROR

Stacked Diagnostics Accessed Without Active Handler — SQLSTATE 0Z002

stacked_diagnostics_accessed_without_active_handler

SQLSTATE 0Z002 (stacked_diagnostics_accessed_without_active_handler): Stacked diagnostics were accessed without an active handler.

Diagnostics Exception
10608 ERROR

Invalid Argument For Xquery — SQLSTATE 10608

invalid_argument_for_xquery

PostgreSQL raises SQLSTATE 10608 (invalid_argument_for_xquery), a ERROR in the XQuery Error class. Inspect the server log for context.

XQuery Error
20000 ERROR

Case Not Found — SQLSTATE 20000

case_not_found

SQLSTATE 20000 (case_not_found): A CASE expression matched no branch and had no ELSE.

Case Not Found
21000 ERROR

ON CONFLICT DO UPDATE command cannot affect row a second time — 21000

cardinality_violation

PostgreSQL error "ON CONFLICT DO UPDATE command cannot affect row a second time" (SQLSTATE 21000): what it means, common causes, and how to fix it.

Cardinality Violation
21000 ERROR

more than one row returned by a subquery used as an expression — 21000

cardinality_violation

PostgreSQL error "more than one row returned by a subquery used as an expression" (SQLSTATE 21000): what it means, common causes, and how to fix it.

Cardinality Violation
21000 ERROR

Cardinality Violation — SQLSTATE 21000

cardinality_violation

A scalar context received more than one row.

Cardinality Violation
22000 ERROR

range lower bound must be less than or equal to range upper bound — 22000

data_exception

PostgreSQL error "range lower bound must be less than or equal to range upper bound" (SQLSTATE 22000): what it means, common causes, and how to fix it.

Data Exception
22000 ERROR

Data Exception — SQLSTATE 22000

data_exception

SQLSTATE 22000 (data_exception): A value is invalid for its data type or the operation applied to it.

Data Exception
22001 ERROR

value too long for type character varying(N) — 22001

string_data_right_truncation

PostgreSQL error "value too long for type character varying(N)" (SQLSTATE 22001): what it means, common causes, and how to fix it.

Data Exception
22001 ERROR

String Data Right Truncation — SQLSTATE 22001

string_data_right_truncation

A string value is too long for the target character column.

Data Exception
22002 ERROR

Null Value No Indicator Parameter — SQLSTATE 22002

null_value_no_indicator_parameter

SQLSTATE 22002 (null_value_no_indicator_parameter): A value is invalid for its data type or the operation applied to it.

Data Exception
22003 ERROR

smallint out of range — 22003

numeric_value_out_of_range

PostgreSQL error "smallint out of range" (SQLSTATE 22003): what it means, common causes, and how to fix it.

Data Exception
22003 ERROR

numeric field overflow — 22003

numeric_value_out_of_range

PostgreSQL error "numeric field overflow" (SQLSTATE 22003): what it means, common causes, and how to fix it.

Data Exception
22003 ERROR

integer out of range — 22003

numeric_value_out_of_range

PostgreSQL error "integer out of range" (SQLSTATE 22003): what it means, common causes, and how to fix it.

Data Exception
22003 ERROR

value “…” is out of range for type bigint — 22003

numeric_value_out_of_range

PostgreSQL error "value … is out of range for type bigint — 22003" (SQLSTATE 22003): what it means, common causes, and how to fix it.

Data Exception
22003 ERROR

bigint out of range — 22003

numeric_value_out_of_range

PostgreSQL error "bigint out of range" (SQLSTATE 22003): what it means, common causes, and how to fix it.

Data Exception
22003 ERROR

value out of range: overflow — 22003

numeric_value_out_of_range

PostgreSQL error "value out of range: overflow" (SQLSTATE 22003): what it means, common causes, and how to fix it.

Data Exception
22003 ERROR

value out of range: underflow — 22003

numeric_value_out_of_range

PostgreSQL error "value out of range: underflow" (SQLSTATE 22003): what it means, common causes, and how to fix it.

Data Exception