Look up a PostgreSQL error by SQLSTATE or message: what it means, why it happens, read-only checks, safe fixes and examples run against PostgreSQL.
Common errors 8
23505
duplicate key value violates unique constraintA value already exists in a primary key, unique constraint or unique index, often because a sequence is behind the data.
23503
insert or update on table violates foreign key constraintA row points at a missing parent row, or a parent row that is still referenced would be deleted or changed.
42P01
relation does not existA table or view name was not found: case folding, search_path, schema privileges or the wrong database.
42703
column does not existA column name matches no column in scope: case, typos, double-quoted strings or aliases used in WHERE.
22P02
invalid input syntax for type integerText is not valid input for integer, numeric, uuid, boolean, json, an enum or an array.
25P02
current transaction is aborted, commands ignored until end of transaction blockAn earlier statement in the transaction failed; every later one is refused until ROLLBACK or ROLLBACK TO SAVEPOINT.
40P01
deadlock detectedTwo transactions waited for each other's locks, so PostgreSQL aborted one of them.
28P01
password authentication failed for userThe login reached the password check and failed: wrong, missing or expired password.
Integrity Constraints 3
23505
duplicate key value violates unique constraintA value already exists in a primary key, unique constraint or unique index, often because a sequence is behind the data.
23503
insert or update on table violates foreign key constraintA row points at a missing parent row, or a parent row that is still referenced would be deleted or changed.
23502
null value in column violates not-null constraintA row would store NULL in a NOT NULL or primary key column.
Syntax & Names 4
42P01
relation does not existA table or view name was not found: case folding, search_path, schema privileges or the wrong database.
42703
column does not existA column name matches no column in scope: case, typos, double-quoted strings or aliases used in WHERE.
42601
syntax error at or nearThe statement could not be parsed: a stray comma, a reserved word or syntax from another database.
42702
column reference is ambiguousAn unqualified column exists in more than one joined table, or clashes with a PL/pgSQL variable.
Types & Expressions 4
42883
operator does not existNo operator or function accepts these argument types (integer = text, round(double precision, integer), isnull).
42804
column is of type integer but expression is of type textA value has the wrong type for its column, UNION or CASE branch, condition or ALTER COLUMN TYPE.
42803
column must appear in the GROUP BY clause or be used in an aggregate functionA column is neither grouped nor aggregated, or an aggregate is used in WHERE, UPDATE or inside another aggregate.
21000
more than one row returned by a subquery used as an expressionA scalar subquery returned several rows, or ON CONFLICT DO UPDATE or MERGE would change one row twice.
Data Exceptions 3
22P02
invalid input syntax for type integerText is not valid input for integer, numeric, uuid, boolean, json, an enum or an array.
22003
integer out of rangeA number is too large for its type: integer or smallint overflow, numeric field overflow, float overflow.
22001
value too long for type character varyingA string is longer than its varchar(n) or char(n) column or variable allows.
Transactions & Concurrency 4
25P02
current transaction is aborted, commands ignored until end of transaction blockAn earlier statement in the transaction failed; every later one is refused until ROLLBACK or ROLLBACK TO SAVEPOINT.
40P01
deadlock detectedTwo transactions waited for each other's locks, so PostgreSQL aborted one of them.
40001
could not serialize access due to concurrent updateA Repeatable Read or Serializable transaction conflicted with a concurrent one; retry it.
57014
canceling statement due to statement timeoutThe statement exceeded statement_timeout or was cancelled by a cancel request.
Connections, Authentication & Privileges 6
28P01
password authentication failed for userThe login reached the password check and failed: wrong, missing or expired password.
28000
no pg_hba.conf entry for hostNo pg_hba.conf line allows the connection, or the role is missing, cannot log in or failed peer/ident.
3D000
database does not existThe database named in the connection or statement does not exist on this server.
53300
sorry, too many clients alreadyA connection limit was reached: max_connections, reserved slots, or a role/database CONNECTION LIMIT.
08001
connection to server failed: Connection refusedThe client could not reach a server at that host, port or socket (reported by libpq/psql).
42501
permission denied for tableThe current role lacks a privilege on the table, schema, sequence or function, or does not own the object.
No errors match. Press Search to search full messages, or browse every error.