pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #9840: Documentation bug on pg_locks
3+ messages / 3 participants
[nested] [flat]
* BUG #9840: Documentation bug on pg_locks
@ 2014-04-03 08:04 bashtanov@imap.cc
2014-04-03 11:58 ` Re: BUG #9840: Documentation bug on pg_locks Michael Paquier <michael.paquier@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: bashtanov@imap.cc @ 2014-04-03 08:04 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 9840
Logged by: Alexey Bashtanov
Email address: bashtanov@imap.cc
PostgreSQL version: 9.3.4
Operating system: -
Description:
Hello!
Documentation
http://www.postgresql.org/docs/current/static/view-pg-locks.html states that
"if you are using prepared transactions, the transaction column can be
joined to the transaction column of the pg_prepared_xacts view to get more
information on prepared transactions that hold locks."
However, there is no "transaction" column in pg_locks.
Neither transactionid nor virtualtransaction could be the mentioned column
as transactionid is "null if the target is not a transaction ID" and
virtualtransaction has different column data type.
Please could you clarify the docs.
Regards,
Alexey Bashtanov
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #9840: Documentation bug on pg_locks
2014-04-03 08:04 BUG #9840: Documentation bug on pg_locks bashtanov@imap.cc
@ 2014-04-03 11:58 ` Michael Paquier <michael.paquier@gmail.com>
2014-04-03 15:21 ` Re: BUG #9840: Documentation bug on pg_locks Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Paquier @ 2014-04-03 11:58 UTC (permalink / raw)
To: bashtanov@imap.cc; +Cc: pgsql-bugs
On Thu, Apr 3, 2014 at 5:04 PM, <bashtanov@imap.cc> wrote:
> However, there is no "transaction" column in pg_locks.
>
> Neither transactionid nor virtualtransaction could be the mentioned column
> as transactionid is "null if the target is not a transaction ID" and
> virtualtransaction has different column data type.
Yes, documentation is unclear, but even if virtualtransaction has text
as data type, it is the combination of backendID/TransactionID so you
could use that for a join with pg_prepared_xacts like that:
=# create table aa (a int);
CREATE TABLE
=# begin;
BEGIN
=# insert into aa values (1);
INSERT 0 1
=# prepare transaction 'toto';
PREPARE TRANSACTION
=# select locktype, mode, gid, relation
from pg_locks pl
join pg_prepared_xacts ppx on
ppx.transaction = split_part(pl.virtualtransaction, '/', 2)::xid;
locktype | mode | gid | relation
---------------+------------------+------+----------
relation | RowExclusiveLock | toto | 16385
transactionid | ExclusiveLock | toto | null
(2 rows)
At the same time, I am attaching a doc patch recommending using
virtualtransaction instead of transaction in pg_locks when doing a
join with pg_prepared_xacts.
Regards,
--
Michael
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Attachments:
20140403_pg_locks_docfix.patch (text/plain, 679B) download
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index a12ee56..a712c68 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -7875,7 +7875,7 @@
<structname>pg_stat_activity</structname> view to get more
information on the session holding or waiting to hold each lock.
Also, if you are using prepared transactions, the
- <structfield>transaction</> column can be joined to the
+ <structfield>virtualtransaction</> column can be joined to the
<structfield>transaction</structfield> column of the
<structname>pg_prepared_xacts</structname> view to get more
information on prepared transactions that hold locks.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #9840: Documentation bug on pg_locks
2014-04-03 08:04 BUG #9840: Documentation bug on pg_locks bashtanov@imap.cc
2014-04-03 11:58 ` Re: BUG #9840: Documentation bug on pg_locks Michael Paquier <michael.paquier@gmail.com>
@ 2014-04-03 15:21 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Tom Lane @ 2014-04-03 15:21 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: bashtanov@imap.cc; pgsql-bugs
Michael Paquier <michael.paquier@gmail.com> writes:
> At the same time, I am attaching a doc patch recommending using
> virtualtransaction instead of transaction in pg_locks when doing a
> join with pg_prepared_xacts.
That change doesn't really seem good enough to me, since exactly how to do
the join remains just as unclear as before. I think we'd better give an
explicit example. I'd be inclined to write it as
select * from
pg_locks pl join pg_prepared_xacts ppx
on pl.virtualtransaction = '-1/' || ppx.transaction;
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2014-04-03 15:21 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-04-03 08:04 BUG #9840: Documentation bug on pg_locks bashtanov@imap.cc
2014-04-03 11:58 ` Michael Paquier <michael.paquier@gmail.com>
2014-04-03 15:21 ` 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