Re: Wrong FOR UPDATE lock type - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Wrong FOR UPDATE lock type
Date
Msg-id 6735.975962147@sss.pgh.pa.us
Whole thread Raw
In response to Wrong FOR UPDATE lock type  (Jan Wieck <janwieck@yahoo.com>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: bpalmer
Date:
Subject: Re: beta testing version
Next
From: Tom Lane
Date:
Subject: Re: Using Threads?