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

42804 ERROR

column “…” cannot be cast automatically to type … — 42804

datatype_mismatch

PostgreSQL error "column "…" cannot be cast automatically to type …" (SQLSTATE 42804): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42804 ERROR

argument of WHERE must be type boolean, not type … — 42804

datatype_mismatch

PostgreSQL error "argument of WHERE must be type boolean, not type …" (SQLSTATE 42804): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42804 ERROR

default for column “…” cannot be cast automatically to type … — 42804

datatype_mismatch

PostgreSQL error "default for column "…" cannot be cast automatically to type …" (SQLSTATE 42804): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42804 ERROR

UNION types … and … cannot be matched — 42804

datatype_mismatch

PostgreSQL error "UNION types … and … cannot be matched" (SQLSTATE 42804): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42804 ERROR

column “…” cannot be cast automatically to type … — 42804

datatype_mismatch

PostgreSQL error "column … cannot be cast automatically to type … — 42804" (SQLSTATE 42804): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42804 ERROR

Datatype Mismatch — SQLSTATE 42804

datatype_mismatch

An expression has the wrong data type for its context.

Syntax Error or Access Rule Violation
42804 ERROR

column “…” is of type … but expression is of type … — 42804

datatype_mismatch

PostgreSQL error "column "…" is of type … but expression is of type …" (SQLSTATE 42804): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42809 ERROR

“…” is a foreign table — 42809

wrong_object_type

PostgreSQL error ""…" is a foreign table" (SQLSTATE 42809): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42809 ERROR

relation “…” is not a table — 42809

wrong_object_type

PostgreSQL error "relation "…" is not a table" (SQLSTATE 42809): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42809 ERROR

“…” is not a view — 42809

wrong_object_type

PostgreSQL error ""…" is not a view" (SQLSTATE 42809): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42809 ERROR

Wrong Object Type — SQLSTATE 42809

wrong_object_type

SQLSTATE 42809 (wrong_object_type): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
42830 ERROR

there is no unique constraint matching given keys for referenced table “…” — 42830

invalid_foreign_key

PostgreSQL error "there is no unique constraint matching given keys for referenced table "…"" (SQLSTATE 42830): what it means, common causes, and how to...

Syntax Error or Access Rule Violation
42830 ERROR

Invalid Foreign Key — SQLSTATE 42830

invalid_foreign_key

SQLSTATE 42830 (invalid_foreign_key): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
42846 ERROR

Cannot Coerce — SQLSTATE 42846

cannot_coerce

A cast between the two types is not allowed.

Syntax Error or Access Rule Violation
42883 ERROR

could not identify an ordering operator for type … — 42883

undefined_function

PostgreSQL error "could not identify an ordering operator for type …" (SQLSTATE 42883): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42883 ERROR

function … does not exist — 42883

undefined_function

PostgreSQL error "function … does not exist" (SQLSTATE 42883): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42883 ERROR

operator does not exist: … = … — 42883

undefined_function

PostgreSQL error "operator does not exist: … = …" (SQLSTATE 42883): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42883 ERROR

could not identify an equality operator for type … — 42883

undefined_function

PostgreSQL error "could not identify an equality operator for type …" (SQLSTATE 42883): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42883 ERROR

Undefined Function — SQLSTATE 42883

undefined_function

No function or operator matches the name and argument types.

Syntax Error or Access Rule Violation
42883 ERROR

operator does not exist: … — 42883

undefined_function

PostgreSQL error "operator does not exist: …" (SQLSTATE 42883): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
428C9 ERROR

cannot insert a non-DEFAULT value into column “…” — 428C9

generated_always

PostgreSQL error "cannot insert a non-DEFAULT value into column "…"" (SQLSTATE 428C9): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
428C9 ERROR

Generated Always — SQLSTATE 428C9

generated_always

SQLSTATE 428C9 (generated_always): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
428C9 ERROR

column “…” can only be updated to DEFAULT — 428C9

generated_always

PostgreSQL error "column "…" can only be updated to DEFAULT" (SQLSTATE 428C9): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42939 ERROR

Reserved Name — SQLSTATE 42939

reserved_name

SQLSTATE 42939 (reserved_name): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation