From 1ba676b1ff8f9c7ab7efb3929fb179d6a1be14df Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Thu, 10 Sep 2015 12:21:01 +0200 Subject: [PATCH] Support locktype='transactionid' --- reports/locks | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/reports/locks b/reports/locks index 6f91377..4807eeb 100755 --- a/reports/locks +++ b/reports/locks @@ -9,7 +9,7 @@ use Encode qw(:fallbacks encode); my $db = shift // "default"; -my $dbh = DBIx::SimpleConnect->connect($db); +my $dbh = DBIx::SimpleConnect->connect($db, {RaiseError => 1}); my $sth = $dbh->prepare(" @@ -19,7 +19,11 @@ my $sth locks_blocked.pid as blocked_pid, query_blocked.query as blocked_query, query_blocked.usename as blocked_username - from pg_locks locks_blocked join pg_locks locks_blocking using (locktype, database, relation) + from pg_locks locks_blocked join pg_locks locks_blocking + on (locks_blocked.locktype='relation' and locks_blocking.locktype='relation' and locks_blocked.database=locks_blocking.database and locks_blocked.relation=locks_blocking.relation + or locks_blocked.locktype='transactionid' and locks_blocking.locktype='transactionid' and locks_blocked.transactionid=locks_blocking.transactionid + -- don't know how to handle virtualxid + ) join pg_stat_activity query_blocked on (locks_blocked.pid=query_blocked.pid) join pg_stat_activity query_blocking on (locks_blocking.pid = query_blocking.pid) where locks_blocking.granted and not locks_blocked.granted