PostgreSQL Error Reference

Every error, explained

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

1291 errors documentedFree diagnostics on every pageAll PG versions covered

Showing 960 of 1291 errors

42P07 ERROR

Duplicate Table — SQLSTATE 42P07

duplicate_table

A relation with that name already exists.

Syntax Error or Access Rule Violation
42P07 ERROR

relation “…” already exists — 42P07

duplicate_table

PostgreSQL error "relation "…" already exists" (SQLSTATE 42P07): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P07 ERROR

relation “…” would be inherited from more than once — 42P07

duplicate_table

PostgreSQL error "relation "…" would be inherited from more than once" (SQLSTATE 42P07, duplicate_table): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P07 ERROR

circular inheritance not allowed — 42P07

duplicate_table

PostgreSQL error "circular inheritance not allowed" (SQLSTATE 42P07, duplicate_table): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P08 ERROR

Ambiguous Parameter — SQLSTATE 42P08

ambiguous_parameter

SQLSTATE 42P08 (ambiguous_parameter): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
42P09 ERROR

Ambiguous Alias — SQLSTATE 42P09

ambiguous_alias

SQLSTATE 42P09 (ambiguous_alias): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
42P10 ERROR

Invalid Column Reference — SQLSTATE 42P10

invalid_column_reference

SQLSTATE 42P10 (invalid_column_reference): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
42P10 ERROR

cannot use column reference in DEFAULT expression — 42P10

invalid_column_reference

PostgreSQL error "cannot use column reference in DEFAULT expression" (SQLSTATE 42P10): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P10 ERROR

GROUP BY position … is not in select list — 42P10

invalid_column_reference

PostgreSQL error "GROUP BY position … is not in select list" (SQLSTATE 42P10): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P10 ERROR

ORDER BY position … is not in select list — 42P10

invalid_column_reference

PostgreSQL error "ORDER BY position … is not in select list" (SQLSTATE 42P10): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P10 ERROR

for SELECT DISTINCT, ORDER BY expressions must appear in select list — 42P10

invalid_column_reference

PostgreSQL error "for SELECT DISTINCT, ORDER BY expressions must appear in select list" (SQLSTATE 42P10): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P10 ERROR

there is no unique or exclusion constraint matching the ON CONFLICT specification — 42P10

invalid_column_reference

PostgreSQL error "there is no unique or exclusion constraint matching the ON CONFLICT specification" (SQLSTATE 42P10): what it means, common causes, and...

Syntax Error or Access Rule Violation
42P10 ERROR

cannot delete from table “…” — 42P10

invalid_column_reference

PostgreSQL error "cannot delete from table "…"" (SQLSTATE 42P10, invalid_column_reference): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P10 ERROR

cannot update table “…” — 42P10

invalid_column_reference

PostgreSQL error "cannot update table "…"" (SQLSTATE 42P10, invalid_column_reference): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P11 ERROR

Invalid Cursor Definition — SQLSTATE 42P11

invalid_cursor_definition

SQLSTATE 42P11 (invalid_cursor_definition): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
42P11 ERROR

cannot open … query as cursor — 42P11

invalid_cursor_definition

PostgreSQL error "cannot open … query as cursor" (SQLSTATE 42P11): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P12 ERROR

Invalid Database Definition — SQLSTATE 42P12

invalid_database_definition

SQLSTATE 42P12 (invalid_database_definition): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
42P13 ERROR

Invalid Function Definition — SQLSTATE 42P13

invalid_function_definition

SQLSTATE 42P13 (invalid_function_definition): The SQL is malformed or references a missing object or privilege.

Syntax Error or Access Rule Violation
42P13 ERROR

cannot change return type of existing function — 42P13

invalid_function_definition

PostgreSQL error "cannot change return type of existing function" (SQLSTATE 42P13): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P13 ERROR

event trigger functions cannot have declared arguments — 42P13

invalid_function_definition

PostgreSQL error "event trigger functions cannot have declared arguments" (SQLSTATE 42P13, invalid_function_definition): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P13 ERROR

trigger functions cannot have declared arguments — 42P13

invalid_function_definition

PostgreSQL error "trigger functions cannot have declared arguments" (SQLSTATE 42P13, invalid_function_definition): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P13 ERROR

must specify both or neither of serialization and deserialization f… — 42P13

invalid_function_definition

PostgreSQL error "must specify both or neither of serialization and deserialization functions" (SQLSTATE 42P13, invalid_function_definition): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P13 ERROR

serialization functions may be specified only when the aggregate tr… — 42P13

invalid_function_definition

PostgreSQL error "serialization functions may be specified only when the aggregate transition data type is …" (SQLSTATE 42P13, invalid_function_definition): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P13 ERROR

aggregate transition data type cannot be … — 42P13

invalid_function_definition

PostgreSQL error "aggregate transition data type cannot be …" (SQLSTATE 42P13, invalid_function_definition): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation