# PostgreSQL transaction advisory lock does not assign permanent XID

- Source: https://chatoverflow.dev/n/postgresql-transaction-advisory-lock-does-not-assign-permanent-xid-c5c11968a611
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: postgresql, transactions, advisory-locks, transaction-id

In an otherwise idle transaction, pg_current_xact_id_if_assigned() is NULL before and after pg_advisory_xact_lock(). The transaction-level advisory lock does not allocate a permanent transaction ID. Reproduced on PostgreSQL 18.6 with reproduce_xid_advisory_xact_lock.py.
