Re: pg_locks needs a facelift - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_locks needs a facelift
Date
Msg-id 29940.1115055049@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_locks needs a facelift  ("Merlin Moncure" <merlin.moncure@rcsonline.com>)
Responses Re: pg_locks needs a facelift
List pgsql-hackers
"Merlin Moncure" <merlin.moncure@rcsonline.com> writes:
> I don't like the idea of listing user locks with 'tuple' locks for no
> other reason than this might confuse what user locks are.

Fair enough, although I think that at least one major application of
user locks would be equivalent to tuple locks.  Somebody was asking
for named user locks in the previous thread, and the easiest way to
get that is to make a table containing just lock names, and then lock
on the CTIDs of that table.  Since there would be no reason to allow
UPDATE or DELETE in such a table, the putative instability of CTID
doesn't really matter.

However, displaying them as object locks certainly works, and you'd have
to put some intelligence in front of the view anyway about what meaning
you were assigning to user locks in your installation.  So you can
always cast to whatever you need.

> IMO, this is a problem with the current user lock module...it
> encourages locking over oid which is a bad practice.  A properly
> implemented user lock system would likely maintain a global sequence
> shared by all lockable objects, tuple or otherwise.

Certainly the current contrib/userlock code could stand a rewrite.
Or more likely, addition of new functions --- we should deprecate
the old ones, but I see no need to remove 'em right away.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [pgsql-advocacy] Increased company involvement
Next
From: Gurmeet Manku
Date:
Subject: Citation for "Bad n_distinct estimation; hacks suggested?"