pg_locks view versus prepared transactions - Mailing list pgsql-hackers

From Tom Lane
Subject pg_locks view versus prepared transactions
Date
Msg-id 13967.1119109760@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
Now that Heikki's two-phase-commit patch is in, we have a bit of a
problem in the pg_locks view: prepared transactions can hold locks,
but you can't tell which prepared transaction is holding which lock.
They all show with "pid 0".  (This should probably come out as a NULL
instead of 0, but I didn't change it yet.)

I think the minimum thing we ought to do about this is add an XID
column to pg_locks to show the transaction ID holding each lock.
Then you could join that to pg_prepared_xacts to see what's what.

I was also wondering about adding a current-XID column to
pg_stat_activity, and encouraging people to join pg_locks and
pg_stat_activity on XID instead of PID.

Ultimately we should maybe even remove PID from pg_locks, but probably
for backwards compatibility it'd have to be deprecated for a release
or two first.

Thoughts?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tino Wildenhain
Date:
Subject: Re: process crash when a plpython function returns
Next
From: Juan Pablo Espino
Date:
Subject: Login/logout