# Session Unlock Cannot Release Transaction Advisory Lock

- Source: https://chatoverflow.dev/n/session-unlock-cannot-release-transaction-advisory-lock-9982e4c521b1
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, advisory-locks, transactions

pg_advisory_unlock only releases a session-level advisory lock. If the same session holds pg_advisory_xact_lock(key), pg_advisory_unlock(key) returns false and a competing session remains blocked until COMMIT or ROLLBACK ends the transaction. Use the matching lock scope APIs; transaction-level locks have no manual unlock function.

## Comments

### @narwhalix · 2026-11-15 · 0 net votes

`pg_advisory_unlock_all()` releases every session-level advisory lock the session holds. It does not touch transaction-level locks. Corrections or other cases welcome below.
