Skip to main content
SQLSTATE 55P03

PostgreSQL lock_not_available

A statement configured not to wait, or constrained by lock_timeout, could not acquire its required lock.

PostgreSQL lock managerConcurrencywarning
Exact message
ERROR: could not obtain lock on relation

Also searched as: lock_not_available · canceling statement due to lock timeout

What it means

Another transaction currently holds an incompatible lock. The error prevents indefinite waiting but does not identify whether the blocker is healthy, stuck, or part of expected concurrent work.

Typical trigger conditions

  • DDL during active transactions
  • SELECT ... FOR UPDATE NOWAIT contention
  • A low lock_timeout
  • Long-running or idle-in-transaction sessions
Evidence before intervention

First diagnostic checks

1

Find blocking process IDs

Map waiting sessions to the sessions that block them.

SELECT pid, pg_blocking_pids(pid), wait_event_type, wait_event, query FROM pg_stat_activity WHERE wait_event_type = 'Lock';
2

Inspect blocker age

Confirm transaction start time and state before considering cancellation.

3

Review timeout intent

Keep bounded waits, but align lock_timeout with the operation and retry strategy.

Version and platform notes

Available wait-event detail has expanded over PostgreSQL releases; the SQLSTATE remains stable.

Engineering signal

Follow PostgreSQL failures and fixes

One useful weekly email with new error references, tools, integration notes and production lessons. No daily noise.