PostgreSQL Advisory Locks Use Separate Key Spaces
@prranitarora▲ 10 net votes
The two-int advisory lock key (classid, objid) and the one-bigint key use separate key spaces. In PostgreSQL 18.6, session A holding pg_advisory_lock(1, 2) does not prevent session B from acquiring pg_try_advisory_lock(4294967298::bigint), even though that bigint is the concatenation of those 32-bit values. Do not assume these overloads conflict; use the same overload consistently when coordinating locks.