Jan Wieck <janwieck@yahoo.com> writes:
> I'm about 99.666667% sure that the lock type choosen in the
> FOR UPDATE case (line 511 of parse_relation.c) should be
> RowExclusiveLock instead of RowShareLock. Actually I get
> "Deadlock risk" debug messages when selecting FOR UPDATE and
> then really UPDATE.
> Should I change it?
Not sure, but if you do change it, that's *not* the only place. I coded
that as RowShareLock because that was what was getting grabbed by the
executor for SELECT FOR UPDATE. I believe the rewriter may need changed
as well, since it can also be the first grabber of a lock for a rel.
Note also that the docs say SELECT FOR UPDATE gets RowShareLock!
The "deadlock risk" message is not very bright, and I wouldn't suggest
changing the code just because of that. I'm not even sure I want to
leave that check in the release version ...
regards, tom lane