Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 8B8D663348A for ; Wed, 16 Jun 2010 15:42:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 80933-04 for ; Wed, 16 Jun 2010 18:42:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from momjian.us (momjian.us [70.90.9.53]) by mail.postgresql.org (Postfix) with ESMTP id 5083B633223 for ; Wed, 16 Jun 2010 15:42:17 -0300 (ADT) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id o5GEGPD14227; Wed, 16 Jun 2010 10:16:25 -0400 (EDT) From: Bruce Momjian Message-Id: <201006161416.o5GEGPD14227@momjian.us> Subject: Re: For update clause In-Reply-To: <201006160958.16216.cousinflo@free.fr> To: Florence Cousin Date: Wed, 16 Jun 2010 10:16:25 -0400 (EDT) CC: pgsql-docs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.581 tagged_above=-5 required=5 tests=BAYES_40=-0.001, DATE_IN_PAST_03_06=1.592, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: * X-Archive-Number: 201006/38 X-Sequence-Number: 5606 Florence Cousin wrote: > Le mardi 15 juin 2010 22:04:06, Bruce Momjian a ?crit : > > > > Wow, that is a confusing double-negative sentence. I have updated the > > text to be: > > > > 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. > > > > 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 rows > returned are those that would be returned by an UPDATE, that is pretty > logical). > > But I think most of the users will still not understand this, because they do > not know what a snapshot is, and do not really know how locking works. > > And I managed to understand thank to the explanation, but I think I could not > understand with the new version of the explanation alone (the fact that rows > returned are the rows as UPDATE will see them) > > Maybe it would be clearer with a longer explanation, or a link to an > explanation? Well, the entire area is very complicated, but do we want to add even more text there? I am not sure. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + None of us is going to be here forever. +