Hello,

documentation about advisory locks in the pg_locks view
<http://developer.postgresql.org/pgdocs/postgres/view-pg-locks.html>
is incorrect/incomplete: the space specifier field is objsubid, not
objid, and there is no information about how the key is stored.

    => select pg_advisory_lock(1111, 2222);
    => select pg_advisory_lock((3333 * 2^32 + 4444)::bigint);
    => select classid, objid, objsubid from pg_locks where locktype='advisory';
     classid | objid | objsubid
    ---------+-------+----------
        3333 |  4444 |        1
        1111 |  2222 |        2

I've only checked the classid/objid/objsubid fields, don't know about
the other ones.

Proposed patch attached.

-- Daniele
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index f1dcf8a..0a0c692 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -7193,7 +7193,9 @@
       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
       <entry>
        OID of the system catalog containing the lock target, or null if the
-       target is not a general database object
+       target is not a general database object.
+       For advisory locks it is the first int4 key
+       or the high half of the int8 key.
       </entry>
      </row>
      <row>
@@ -7203,8 +7205,8 @@
       <entry>
        OID of the lock target within its system catalog, or null if the
        target is not a general database object.
-       For advisory locks it is used to distinguish the two key
-       spaces (1 for an int8 key, 2 for two int4 keys).
+       For advisory locks it is the second int4 key
+       or the low half of the int8 key.
       </entry>
      </row>
      <row>
@@ -7216,7 +7218,9 @@
        <structfield>classid</> and <structfield>objid</> refer to the
        table itself),
        or zero if the target is some other general database object,
-       or null if the target is not a general database object
+       or null if the target is not a general database object.
+       For advisory locks it is used to distinguish the two key
+       spaces (1 for an int8 key, 2 for two int4 keys).
       </entry>
      </row>
      <row>
-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs

Reply via email to