Re: Can pessimistic locking be emulated? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Can pessimistic locking be emulated?
Date
Msg-id 27562.1046376159@sss.pgh.pa.us
Whole thread Raw
In response to Re: Can pessimistic locking be emulated?  (Rod Taylor <rbt@rbt.ca>)
Responses Re: Can pessimistic locking be emulated?
List pgsql-hackers
Rod Taylor <rbt@rbt.ca> writes:
> Agreed -- but they're stored on the row themselves.  You might be able
> to write a function which executes dirty reads on the table and tells
> you if the row is locked or not, but it's not going to be simple.

Actually, I don't think you need a dirty read at all.  A locked row
can't be deleted as well (because there's only one xmax slot), so if you
can see it (ie, you think its xmin is committed) then you can in
principle find out whether it's locked or not.  We just don't expose the
info at the moment.  (You can see xmax at the user level, but you can't
easily tell if xmax is trying to delete the row or just lock it, because
you don't have access to the infomask bit that would tell you.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: mlw
Date:
Subject: Re: analyze after a database restore?
Next
From: Rod Taylor
Date:
Subject: Re: Can pessimistic locking be emulated?