Advisory Lock BIGINT Values

From: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Advisory Lock BIGINT Values
Date: 2012-03-10 00:36:08
Message-ID: 69AC7BDF-4AA8-46FF-A6D9-8BD6FDB5A859@justatheory.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

The documentation for pg_locks says that, for BIGINT advisory locks:

> A bigint key is displayed with its high-order half in the classid column, its low-order half in the objid column

I was in need of knowing what the bigint is that is waiting on a lock, and Andrew Dunstan was kind enough to help me out with that. Since other folks might also need it, here’s a doc patch.

diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
new file mode 100644
index 9564e01..de1c266
*** a/doc/src/sgml/catalogs.sgml
--- b/doc/src/sgml/catalogs.sgml
***************
*** 7313,7319 ****
A <type>bigint</type> key is displayed with its
high-order half in the <structfield>classid</> column, its low-order half
in the <structfield>objid</> column, and <structfield>objsubid</> equal
! to 1. Integer keys are displayed with the first key in the
<structfield>classid</> column, the second key in the <structfield>objid</>
column, and <structfield>objsubid</> equal to 2. The actual meaning of
the keys is up to the user. Advisory locks are local to each database,
--- 7313,7322 ----
A <type>bigint</type> key is displayed with its
high-order half in the <structfield>classid</> column, its low-order half
in the <structfield>objid</> column, and <structfield>objsubid</> equal
! to 1. The original <type>bigint</type> value can be reassembled with the
! expression <literal>(classid::int::bit(64) &lt;&lt; 32 |
! objid::int::bit(64))::bigint</literal>. Integer keys are displayed with the
! first key in the
<structfield>classid</> column, the second key in the <structfield>objid</>
column, and <structfield>objsubid</> equal to 2. The actual meaning of
the keys is up to the user. Advisory locks are local to each database,

Best,

DAvid

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Antonin Houska 2012-03-10 00:36:18 lateral function as a subquery - WIP patch
Previous Message Tom Lane 2012-03-10 00:05:28 Re: Caching for stable expressions with constant arguments v6