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