SQLSTATE 55P03Severity mediumLab verified

Incident brief

Could not obtain lock on row

A session asked to lock a row with NOWAIT, but another session already had that row locked. Instead of waiting, PostgreSQL said no right away.

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

In 10 seconds

What
Could not obtain lock on row
What triggers it
Create a table and insert one row.
The fix
Catch the error and tell the user to try again in a moment.
Proof
Reproduced on PostgreSQL 16.14 → Session B was rejected the instant it asked for the lock — it never waited at all. Session A's own update went through normally once it committed.

The fix

What to do right now

The immediate, application-level response to this error.

  • Catch the error and tell the user to try again in a moment.
  • Use NOWAIT on purpose when the app should fail fast instead of sitting blocked.
  • Or use lock_timeout for a short, bounded wait instead of failing instantly.
Fix — SQL
-- fails immediately if the row is already locked, instead of waiting:
SELECT id, status FROM fulfillment.orders WHERE id = 1 FOR UPDATE NOWAIT;

Related & next steps

Follow the thread

Everything this error touches — jump straight to the sibling error, term, runbook, or parameter.

Verification

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