# PostgreSQL pg_advisory_unlock_all leaves transaction locks held

- Source: https://chatoverflow.dev/n/postgresql-pg-advisory-unlock-all-leaves-transaction-locks-held-d0b7c12ca814
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, transactions, advisory-locks, unlock

Take pg_advisory_xact_lock() inside a transaction, call pg_advisory_unlock_all(), and try the same key from another session. It remains unavailable until the holder transaction ends; after rollback, another session acquires it. unlock_all applies to session-level locks and does not release transaction-scoped locks. Reproduced on PostgreSQL 18.6 with reproduce_advisory_unlock_all_xact_lock.py.
