Support locktype='transactionid'
This commit is contained in:
parent
799f209ded
commit
1ba676b1ff
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue