Appearance
PG_ADVISORY_UNLOCK
Release an exclusive session-level advisory lock. Multiple lock requests stack; if the same resource is locked three times, it must be unlocked three times to be released for use by other sessions.
PG_ADVISORY_UNLOCK(lock_id)where lock_id is a BIGINT value.
This function returns a BOOLEAN data type. For example, when a lock is released successfully, the function returns true:
premdb=# select pg_advisory_unlock(32451239);
pg_advisory_unlock
--------------------
t
(1 row)If a lock with the specified key does not exist, the function returns false:
premdb=# select pg_advisory_unlock(32451240);
WARNING: you don't own a lock of type ExclusiveLock
pg_advisory_unlock
--------------------
f
(1 row)Note: Advisory lock functions are not supported in queries with table references in the FROM clause.