postgres-errors-constraint-violations
Installation
SKILL.md
postgres-errors-constraint-violations
Quick Reference :
A constraint violation is PostgreSQL refusing a write that would break data integrity. Every one of them carries a SQLSTATE in class 23 (integrity_constraint_violation). The class is never a database bug : it is the database doing its job. The fix is always in the schema or the application, never in suppressing the error.
ERROR: duplicate key value violates unique constraint "users_email_key"
DETAIL: Key (email)=(a@b.com) already exists. -- SQLSTATE 23505
The six class 23 codes you will meet :