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

40P01 ERROR

deadlock detected — 40P01

deadlock_detected

PostgreSQL error "deadlock detected — 40P01" (SQLSTATE 40P01): what it means, common causes, and how to fix it.

Transaction Rollback
40P01 ERROR

Deadlock Detected — SQLSTATE 40P01

deadlock_detected

Two or more transactions blocked each other and PostgreSQL aborted one to break the deadlock.

Transaction Rollback
42000 ERROR

Syntax Error Or Access Rule Violation — SQLSTATE 42000

syntax_error_or_access_rule_violation

SQLSTATE 42000 (syntax_error_or_access_rule_violation): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
42501 ERROR

new row violates row-level security policy for table “…” — 42501

insufficient_privilege

PostgreSQL error "new row violates row-level security policy for table "…"" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

must be superuser to … — 42501

insufficient_privilege

PostgreSQL error "must be superuser to …" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 FATAL

role “…” is not permitted to log in — 42501

insufficient_privilege

PostgreSQL error "role "…" is not permitted to log in" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

permission denied for schema … — 42501

insufficient_privilege

PostgreSQL error "permission denied for schema …" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

must be owner of relation … — 42501

insufficient_privilege

PostgreSQL error "must be owner of relation …" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

new row violates row-level security policy (USING expression) for table “…” — 42501

insufficient_privilege

PostgreSQL error "new row violates row-level security policy (USING expression) for table "…"" (SQLSTATE 42501): what it means, common causes, and how t...

Syntax Error or Access Rule Violation
42501 ERROR

permission denied for table … — 42501

insufficient_privilege

PostgreSQL error "permission denied for table …" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

new row violates row-level security policy for table “…” — 42501

insufficient_privilege

PostgreSQL error "new row violates row-level security policy for table … — 42501" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

permission denied to create database — 42501

insufficient_privilege

PostgreSQL error "permission denied to create database" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

permission denied for sequence … — 42501

insufficient_privilege

PostgreSQL error "permission denied for sequence …" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

permission denied for sequence … — 42501

insufficient_privilege

PostgreSQL error "permission denied for sequence … — 42501" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

permission denied to create role — 42501

insufficient_privilege

PostgreSQL error "permission denied to create role" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

permission denied for function … — 42501

insufficient_privilege

PostgreSQL error "permission denied for function … — 42501" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42501 ERROR

Insufficient Privilege — SQLSTATE 42501

insufficient_privilege

The role lacks a required privilege on the object, schema, or database.

Syntax Error or Access Rule Violation
42501 ERROR

permission denied to set role “…” — 42501

insufficient_privilege

PostgreSQL error "permission denied to set role "…"" (SQLSTATE 42501): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42601 ERROR

subquery in FROM must have an alias — 42601

syntax_error

PostgreSQL error "subquery in FROM must have an alias" (SQLSTATE 42601): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42601 ERROR

VALUES lists must all be the same length — 42601

syntax_error

PostgreSQL error "VALUES lists must all be the same length" (SQLSTATE 42601): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42601 ERROR

each UNION query must have the same number of columns — 42601

syntax_error

PostgreSQL error "each UNION query must have the same number of columns" (SQLSTATE 42601): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42601 ERROR

syntax error at end of input — 42601

syntax_error

PostgreSQL error "syntax error at end of input" (SQLSTATE 42601): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42601 ERROR

INSERT has more expressions than target columns — 42601

syntax_error

PostgreSQL error "INSERT has more expressions than target columns" (SQLSTATE 42601): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42601 ERROR

syntax error at or near “…” — 42601

syntax_error

PostgreSQL error "syntax error at or near "…"" (SQLSTATE 42601): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation