Re: Need help understanding pg_locks - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Need help understanding pg_locks
Date
Msg-id 201107141706.p6EH69105964@momjian.us
Whole thread Raw
In response to Re: Need help understanding pg_locks  (Florian Pflug <fgp@phlo.org>)
Responses Re: Need help understanding pg_locks
List pgsql-hackers
Florian Pflug wrote:
> On Jul13, 2011, at 21:08 , Bruce Momjian wrote:
> > -       OID of the database in which the object exists, or
> > -       zero if the object is a shared object, or
> > -       null if the lock object is on a transaction ID
> > +       OID of the database in which the lock target exists, or
> > +       zero if the lock is a shared object, or
> > +       null if the lock is on a transaction ID
>
> This sounds good.
>
> > +       OID of the relation lock target, or null if the lock is not
> >        on a relation or part of a relation
>
> That, however, not so much. "relation lock target" might easily
> be interpreted as the "relation's lock target" or the
> "relation lock's target" - at least by non-native speakers such
> as myself. The same is true fro "transaction lock target" and
> friends.
>
> Can't we simply go with "Locked relation", "Locked transaction id"
> and so on (as in my versions B,C and D up-thread)? I can't really
> get excited about the slight imprecision caused by the fact that some
> rows describe aspiring lock holders instead of current lock holders.
> The existence of the "granted" column makes the situation pretty clear.
>
> Plus, it's technically not even wrong - a process is waiting because
> somebody else *is* actually holding a lock on the object. So
> the tuple/transaction/... is, in fact, a "Locked tuple/transaction/..."

I think it will be very confusing to have "locked" refer to the person
holding the lock while the row is based on who is waiting for it.

I reworded that line to:

+       OID of the relation of the lock target, or null if the lock is not

Update patch attached.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index c5851af..84c2257 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -6928,9 +6928,9 @@
       <entry><type>oid</type></entry>
       <entry><literal><link
linkend="catalog-pg-database"><structname>pg_database</structname></link>.oid</literal></entry>
       <entry>
-       OID of the database in which the object exists, or
-       zero if the object is a shared object, or
-       null if the lock object is on a transaction ID
+       OID of the database in which the lock target exists, or
+       zero if the lock is a shared object, or
+       null if the lock is on a transaction ID
       </entry>
      </row>
      <row>
@@ -6938,7 +6938,7 @@
       <entry><type>oid</type></entry>
       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
       <entry>
-       OID of the relation, or null if the lock object is not
+       OID of the relation of the lock target, or null if the lock is not
        on a relation or part of a relation
       </entry>
      </row>
@@ -6947,7 +6947,7 @@
       <entry><type>integer</type></entry>
       <entry></entry>
       <entry>
-       Page number within the relation, or null if the lock object
+       Page number within the relation, or null if the lock
        is not on a tuple or relation page
       </entry>
      </row>
@@ -6956,7 +6956,7 @@
       <entry><type>smallint</type></entry>
       <entry></entry>
       <entry>
-       Tuple number within the page, or null if the lock object is not
+       Tuple number within the page, or null if the lock is not
        on a tuple
       </entry>
      </row>
@@ -6965,7 +6965,7 @@
       <entry><type>text</type></entry>
       <entry></entry>
       <entry>
-       Virtual ID of a transaction lock, or null if the lock object is not
+       Virtual ID of a transaction lock target, or null if the lock is not
        on a virtual transaction ID
       </entry>
      </row>
@@ -6974,7 +6974,7 @@
       <entry><type>xid</type></entry>
       <entry></entry>
       <entry>
-       ID of a transaction lock, or null if the lock object is not on a transaction ID
+       ID of a transaction lock target, or null if the lock is not on a transaction ID
       </entry>
      </row>
      <row>
@@ -6982,8 +6982,8 @@
       <entry><type>oid</type></entry>
       <entry><literal><link linkend="catalog-pg-class"><structname>pg_class</structname></link>.oid</literal></entry>
       <entry>
-       OID of the system catalog containing the object, or null if the
-       lock object is not on a general database object.
+       OID of the system catalog containing the lock target, or null if the
+       lock is not on a general database object.
       </entry>
      </row>
      <row>
@@ -6992,7 +6992,7 @@
       <entry>any OID column</entry>
       <entry>
        OID of the object within its system catalog, or null if the
-       lock object is not on a general database object.
+       lock is not on 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>
@@ -7005,7 +7005,7 @@
        For a table column, this is the column number (the
        <structfield>classid</> and <structfield>objid</> refer to the
        table itself).  For all other object types, this column is
-       zero.  Null if the lock object is not on a general database object.
+       zero.  Null if the lock is not on a general database object.
       </entry>
      </row>
      <row>

pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: pg_class.relistemp
Next
From: Robert Haas
Date:
Subject: Re: help with sending email