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

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
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
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
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
42P14 ERROR

Invalid Prepared Statement Definition — SQLSTATE 42P14

invalid_prepared_statement_definition

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

Syntax Error or Access Rule Violation
42P15 ERROR

Invalid Schema Definition — SQLSTATE 42P15

invalid_schema_definition

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

Syntax Error or Access Rule Violation
42P16 ERROR

Invalid Table Definition — SQLSTATE 42P16

invalid_table_definition

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

Syntax Error or Access Rule Violation
42P16 ERROR

multiple primary keys for table “…” are not allowed — 42P16

invalid_table_definition

PostgreSQL error "multiple primary keys for table "…" are not allowed" (SQLSTATE 42P16): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P17 ERROR

Invalid Object Definition — SQLSTATE 42P17

invalid_object_definition

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

Syntax Error or Access Rule Violation
42P17 ERROR

functions in index expression must be marked IMMUTABLE — 42P17

invalid_object_definition

PostgreSQL error "functions in index expression must be marked IMMUTABLE" (SQLSTATE 42P17): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P18 ERROR

could not determine data type of parameter $N — 42P18

indeterminate_datatype

PostgreSQL error "could not determine data type of parameter $N" (SQLSTATE 42P18): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P18 ERROR

Indeterminate Datatype — SQLSTATE 42P18

indeterminate_datatype

PostgreSQL could not determine the type of a parameter or expression.

Syntax Error or Access Rule Violation
42P19 ERROR

Invalid Recursion — SQLSTATE 42P19

invalid_recursion

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

Syntax Error or Access Rule Violation
42P20 ERROR

window functions are not allowed in WHERE — 42P20

windowing_error

PostgreSQL error "window functions are not allowed in WHERE" (SQLSTATE 42P20): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P20 ERROR

Windowing Error — SQLSTATE 42P20

windowing_error

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

Syntax Error or Access Rule Violation
42P20 ERROR

window function … requires an OVER clause — 42P20

windowing_error

PostgreSQL error "window function … requires an OVER clause" (SQLSTATE 42P20): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
42P20 ERROR

window “…” does not exist — 42P20

windowing_error

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

Syntax Error or Access Rule Violation
42P21 ERROR

Collation Mismatch — SQLSTATE 42P21

collation_mismatch

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

Syntax Error or Access Rule Violation
42P22 ERROR

Indeterminate Collation — SQLSTATE 42P22

indeterminate_collation

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

Syntax Error or Access Rule Violation
42P22 ERROR

could not determine which collation to use for string comparison — 42P22

indeterminate_collation

PostgreSQL error "could not determine which collation to use for string comparison" (SQLSTATE 42P22): what it means, common causes, and how to fix it.

Syntax Error or Access Rule Violation
44000 ERROR

With Check Option Violation — SQLSTATE 44000

with_check_option_violation

SQLSTATE 44000 (with_check_option_violation): A row would violate a view's WITH CHECK OPTION.

WITH CHECK OPTION Violation
53000 ERROR

Insufficient Resources — SQLSTATE 53000

insufficient_resources

SQLSTATE 53000 (insufficient_resources): The server ran out of a finite resource (connections, memory, disk, or locks).

Insufficient Resources