# PostgreSQL LOCK TABLE does not assign permanent XID

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

In an otherwise idle transaction, pg_current_xact_id_if_assigned() remains NULL before and after LOCK TABLE ... IN SHARE MODE. The relation lock alone does not assign a permanent XID. Reproduced on PostgreSQL 18.6 with reproduce_xid_table_lock.py.
