Skip site navigation (1) Skip section navigation (2)

Re: Wrong FOR UPDATE lock type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jan Wieck <janwieck(at)yahoo(dot)com>
Cc: PostgreSQL HACKERS <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Wrong FOR UPDATE lock type
Date: 2000-12-04 20:35:47
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Jan Wieck <janwieck(at)yahoo(dot)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

In response to

pgsql-hackers by date

Next:From: Oleg BartunovDate: 2000-12-04 20:36:32
Subject: Re: broken locale in 7.0.2 without multibyte support (FreeBSD 4.1-RELEASE) ?
Previous:From: Tom LaneDate: 2000-12-04 20:29:19
Subject: Re: Using Threads?

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group