Alvaro Herrera <alvherre@dcc.uchile.cl> writes:
> ISTM it would be better to have pg_locks show only system locks, and
> another view, say pg_userlocks, to show user locks. This would allow to
> show different data; for example, the PID of the process involved.
I think this is a bad idea, at least for the base-level view, because it
would imply that it's impossible to get a truly simultaneous view of the
state of all the locks. It would certainly be a bad idea to so separate
xact and table locks. I'd prefer to extend the present approach and add
columns that are NULL when the type of lock isn't relevant to them.
> Another option would be to add another column to pg_locks to say what
> lockmethod (1 for system, 2 for user) is used in each lock.
How about a text column with values "TABLE", "XACT", "USER"?
regards, tom lane