Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 6D80363303C for ; Wed, 16 Jun 2010 04:58:31 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 37361-04 for ; Wed, 16 Jun 2010 07:58:24 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from smtp6-g21.free.fr (smtp6-g21.free.fr [212.27.42.6]) by mail.postgresql.org (Postfix) with ESMTP id 4038D632B3F for ; Wed, 16 Jun 2010 04:58:22 -0300 (ADT) Received: from toto.localnet (gev44-1-78-228-108-65.fbx.proxad.net [78.228.108.65]) by smtp6-g21.free.fr (Postfix) with ESMTP id 2BA13E0809F for ; Wed, 16 Jun 2010 09:58:17 +0200 (CEST) From: Florence Cousin To: pgsql-docs@postgresql.org Subject: Re: For update clause Date: Wed, 16 Jun 2010 09:58:15 +0200 User-Agent: KMail/1.13.2 (Linux/2.6.33-ARCH; KDE/4.4.2; x86_64; ; ) References: <201006152004.o5FK46616620@momjian.us> In-Reply-To: <201006152004.o5FK46616620@momjian.us> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <201006160958.16216.cousinflo@free.fr> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-5 required=5 tests=BAYES_50=0.8, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201006/35 X-Sequence-Number: 5603 Le mardi 15 juin 2010 22:04:06, Bruce Momjian a =E9crit : >=20 > Wow, that is a confusing double-negative sentence. I have updated the > text to be: >=20 > In addition, rows that satisfied the query conditions as of the > query snapshot will be locked, although they will not be returned > if they were updated after the snapshot and no longer satisfy the > query conditions. >=20 > What it is saying is that SELECT FOR UPDATE will lock all rows that > match the SELECT query using the current snapshot, but the returned rows > might be different because the rows were changed after the snapshot was > taken, and a SELECT FOR UPDATE will return the rows as UPDATE will see > them, which might not match the SELECT snapshot. Yeah, it is confusing. Thank you for the patch and the explanation. It is clear for me now (the ro= ws=20 returned are those that would be returned by an UPDATE, that is pretty=20 logical). But I think most of the users will still not understand this, because they = do=20 not know what a snapshot is, and do not really know how locking works.=20 And I managed to understand thank to the explanation, but I think I could n= ot=20 understand with the new version of the explanation alone (the fact that row= s=20 returned are the rows as UPDATE will see them) Maybe it would be clearer with a longer explanation, or a link to an=20 explanation?