Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 57CC4685E78 for ; Tue, 15 Jun 2010 17:13:20 -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 03378-05-5 for ; Tue, 15 Jun 2010 20:13:12 +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 DE92664121C for ; Tue, 15 Jun 2010 17:05:20 -0300 (ADT) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id o5FK46616620; Tue, 15 Jun 2010 16:04:06 -0400 (EDT) From: Bruce Momjian Message-Id: <201006152004.o5FK46616620@momjian.us> Subject: Re: For update clause In-Reply-To: <201006152142.52200.cousinflo@free.fr> To: Florence Cousin Date: Tue, 15 Jun 2010 16:04:06 -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=-0.011 tagged_above=-5 required=5 tests=BAYES_40=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/34 X-Sequence-Number: 5602 Florence Cousin wrote: > Hi, > > I am one of the french translators of the documentation. I am translating the > reference page of SELECT, but I fail to understand this sentence about the FOR > UPDATE clause ( http://www.postgresql.org/docs/9.0/static/sql- > select.html#SQL-FOR-UPDATE-SHARE ) > > --------------- > In addition, rows that satisfied the query conditions as of the query snapshot > will be locked, although they will not be returned if they have since been > updated to not satisfy the query conditions. > ------------------ > > Could anyone please explain it to me, so that I can translate it properly? A > word for word translation has really no meaning. 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. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + None of us is going to be here forever. +