This is a searchable reference for PostgreSQL error codes — the SQLSTATE values and symbolic condition names from Appendix A of the PostgreSQL manual. PostgreSQL pairs every standard 5-character SQLSTATE with a readable condition name like unique_violation or undefined_table, and that name is what you should match in exception handlers.
How it works
Each PostgreSQL error has a 5-character SQLSTATE whose first two characters are the class. Class 00 is success, 01 warning, 02 no-data, and everything else is an exception — 08 connection, 22 data, 23 integrity constraint, 40 transaction rollback, 42 syntax/access, 53 insufficient resources, 57 operator intervention. Alongside the code, PostgreSQL exposes a condition name that is stable across versions. This tool lets you search by SQLSTATE, by class, by condition name (with or without underscores) or by keyword, and shows the class, condition name and meaning for each.
Why match the condition name
In PL/pgSQL you can write WHEN unique_violation THEN instead of hard-coding '23505'. The named form is self-documenting and survives small changes in the standard. Match a whole class with the SQLSTATE class form only when you genuinely want to catch every member, such as all 23xxx constraint violations.
Example
Handling a duplicate insert gracefully in PL/pgSQL:
BEGIN
INSERT INTO users(email) VALUES ($1);
EXCEPTION
WHEN unique_violation THEN
-- SQLSTATE 23505: row already exists, ignore or update
UPDATE users SET seen_at = now() WHERE email = $1;
END;
The unique_violation handler catches SQLSTATE 23505 and turns a hard failure into an upsert. Everything in this tool runs in your browser; nothing is uploaded.