pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedWrong advisory locks docs in pg_locks
2+ messages / 2 participants
[nested] [flat]
* Wrong advisory locks docs in pg_locks
@ 2011-11-25 13:54 Daniele Varrazzo <daniele.varrazzo@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Daniele Varrazzo @ 2011-11-25 13:54 UTC (permalink / raw)
To: pgsql-docs
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
Attachments:
advisory-locks-doc.patch (text/x-patch, 1.5K) download
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>
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Wrong advisory locks docs in pg_locks
@ 2011-11-26 17:17 Tom Lane <tgl@sss.pgh.pa.us>
parent: Daniele Varrazzo <daniele.varrazzo@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2011-11-26 17:17 UTC (permalink / raw)
To: Daniele Varrazzo <daniele.varrazzo@gmail.com>; +Cc: pgsql-docs
Daniele Varrazzo <daniele.varrazzo@gmail.com> writes:
> 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.
Actually, there is a paragraph further down that correctly explains what
advisory locks look like. I think the best fix is to remove the
incorrect annotation on objid and leave it at that; shoehorning
additional sentences into table columns that are meant to contain
short phrases is not an improvement.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2011-11-26 17:17 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-11-25 13:54 Wrong advisory locks docs in pg_locks Daniele Varrazzo <daniele.varrazzo@gmail.com>
2011-11-26 17:17 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox