PostgreSQL Errors
Browse common PostgreSQL error codes with clear explanations of what triggers each error and how to resolve it.
Data Integrity & Constraint
6- 22001String Data Right Truncation in Postgres
- 22003Numeric Value Out of Range in Postgres
- 23502Null Value in Column Violates Not-Null Constraint in Postgres
- 23503Insert or update on table violates foreign key constraint
- 23505Duplicate Key Value Violates Unique Constraint in Postgres
- 23514New row for relation violates check constraint
Query Structure & Aggregation
7- 22P02Invalid Input Syntax for Type in Postgres
- 42601Syntax Error in Postgres
- 42702Column Reference Is Ambiguous in Postgres
- 42803aggregate function calls cannot be nested
- 42803Column must appear in the GROUP BY clause or be used in an aggregate function
- 42804Column is of type X but expression is of type Y
- 42P21Collation mismatch
Schema & Object Management
8- 2B000Cannot drop role because objects depend on it
- 2BP01Cannot drop constraint used by foreign key in Postgres
- 2BP01Cannot drop schema because objects depend on it
- 42703Column Does Not Exist in Postgres
- 42P01Relation Does Not Exist in Postgres
- 42P07Relation already exists in Postgres
- cannot change name of input parameter
- cannot change return type of existing function