ERROR: new row for relation "x" violates check constraint "y"
A value failed a CHECK constraint (e.g. price > 0, status IN (…)).
Seen on:
PostgreSQL
Meaning
The constraint name tells you which rule failed; DETAIL shows the failing row.
Common causes
- Value outside allowed range
- Enum-like CHECK not updated for new values
- Application validation out of sync
⚡ Quick fix
- Validate before writing
- Update the CHECK constraint when adding allowed values
Detailed fix by platform
PostgreSQL
\d+ products -- shows CHECK constraints
How to diagnose
- Constraint — Which one?
- Value — Failing row
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026