Hi,

    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?


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



Mon, 4 Dec 2000 07:52:50 -0500 (EST)
Jan Wieck <janwieck@yahoo.com>
Wrong FOR UPDATE lock type
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

Mon, 04 Dec 2000 15:35:47 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: Wrong FOR UPDATE lock type 