SQLSTATE 55P03 ERROR Class 55: Object Not In Prerequisite State

lock_not_available could not obtain lock on row in relation “…” — 55P03

PostgreSQL error “could not obtain lock on row in relation … — 55P03” (SQLSTATE 55P03): what it means, common causes, and how to fix it.

PG 9.6, 10, 11, 12, 13, 14, 15, 16, 17, 18 Official docs
Last reviewed Jun 2026 Grounded in source

Diagnostic Queries

Symptoms

A SELECT … FOR UPDATE NOWAIT (or similar) could not immediately acquire a row lock because another transaction holds it. PostgreSQL raises SQLSTATE 55P03 (lock_not_available).

  • A NOWAIT lock request failed instantly.
  • Another transaction holds the conflicting lock.
  • NOWAIT means “fail rather than wait”.

What the server log shows

ERROR:  could not obtain lock on row in relation "orders"

Why PostgreSQL raises this — what the manual says

the SELECT reference (The Locking Clause):

“With NOWAIT, the statement reports an error, rather than waiting, if a selected row cannot be locked immediately.”

NOWAIT tells PostgreSQL to fail immediately rather than block when a row is already locked. If the lock is held by another transaction, the request cannot succeed at once, so PostgreSQL reports 55P03.

Common causes

  • Another transaction holds a conflicting row lock.
  • Contention on hot rows under concurrency.
  • Using NOWAIT in a polling/optimistic pattern.

How to fix it

  1. Retry later, or use SKIP LOCKED to process available rows instead.
  2. Reduce lock-hold time in competing transactions.
  3. Drop NOWAIT (or use a lock timeout) if waiting briefly is acceptable.

Related & next steps

Reference: PostgreSQL 18 — SELECT.

Was this helpful?