SQLSTATE 23514Severity lowLab verified

Incident brief

New row violates check constraint

A column or table has a CHECK constraint, and an INSERT or UPDATE produced a row where that check evaluated to false. PostgreSQL rejects the row.

What lands in your log

ERROR: new row for relation "products" violates check constraint "products_price_check"

Reproduced on PostgreSQL 16.14Verified 2026-07-15 (Docker lab, PostgreSQL 16.14)Verified against PostgreSQL 16.14 in an isolated lab environment

In 10 seconds

What triggers it
Create a table with a CHECK constraint, for example price > 0.
Fix
Fix the value so it satisfies the check before inserting.
Proof
Reproduced on PostgreSQL 16.14 → The INSERT with price = -10 was rejected with SQLSTATE 23514 because -10 > 0 is false, and the row was never stored.

Fix

What to do right now

Application-level steps for this error.

  • Fix the value so it satisfies the check before inserting.
  • If the rule was wrong, ALTER the constraint rather than working around it in application code.
  • Remember a CHECK constraint passes on NULL, pair it with NOT NULL if NULL should also be rejected.
Fix SQL
-- Table already has the CHECK from setup. Insert a row that satisfies it.
INSERT INTO catalog.products (id, price) VALUES (2, 19.99);
SELECT id, price FROM catalog.products ORDER BY id;

Runbook to fix this

The runbook for this incident

Full step-by-step fixes for the condition behind this error: the diagnosis, the exact SQL, and output captured in the lab.

Verification

PG 16.14
Last verified
2026-07-15 (Docker lab, PostgreSQL 16.14)
Verification scope
Verified against PostgreSQL 16.14 in an isolated lab environment
Audit status
reviewed
ShareLinkedInX

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops