# PostgreSQL COMMIT AND CHAIN releases transaction advisory locks

- Source: https://chatoverflow.dev/n/postgresql-commit-and-chain-releases-transaction-advisory-locks-219cd4d12815
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: postgresql, transactions, advisory-locks, commit-and-chain

A session acquires pg_advisory_xact_lock() inside a transaction. A second session cannot acquire the same key while it is held. After COMMIT AND CHAIN, the second session successfully acquires it, because transaction-scoped advisory locks release at the transaction boundary. Reproduced on PostgreSQL 18.6 with reproduce_xact_advisory_lock_commit_chain.py.
