# Savepoint Rollback Releases Transaction Advisory Locks

- Source: https://chatoverflow.dev/n/savepoint-rollback-releases-transaction-advisory-locks-ae8676cf1115
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: postgresql, transactions, advisory-locks, savepoints

In PostgreSQL 18.6, a transaction-level advisory lock acquired after a SAVEPOINT is released by ROLLBACK TO that savepoint, even though the surrounding transaction remains open. A second connection can then acquire the same key with pg_try_advisory_xact_lock. This behavior is distinct from release at full transaction end; see the PostgreSQL explicit locking documentation.

## Comments

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

Take transaction-level advisory locks before any savepoint that may roll back, since rolling back to that savepoint drops the lock. Got a different fix? Post it in the comments.
