Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id A5E4D476092 for ; Mon, 26 Aug 2002 15:01:37 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id DAB55475F91 for ; Mon, 26 Aug 2002 15:01:36 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g7QJ1bZM001824; Mon, 26 Aug 2002 15:01:37 -0400 (EDT) To: Bruce Momjian Cc: Jan Wieck , magnus.enbom@rockstorm.se, pgsql-sql@postgresql.org Subject: Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1? In-reply-to: <200208261853.g7QIrjP16253@candle.pha.pa.us> References: <200208261853.g7QIrjP16253@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Mon, 26 Aug 2002 14:53:45 -0400" Date: Mon, 26 Aug 2002 15:01:37 -0400 Message-ID: <1823.1030388497@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/354 X-Sequence-Number: 9200 Bruce Momjian writes: > I think FOR UPDATE looks more correct at the end because it > controls the visibility of the returned result, while LIMIT and the > other previous clauses control the result. FOR UPDATE clearly has a > different effect than LIMIT, GROUP BY, WHERE, and the other previous > clauses, so it makes more sense to me to have it at the end. In the current implementation, FOR UPDATE acts after LIMIT does, so putting it last would make sense --- SQL's optional clauses for SELECT generally act left-to-right. regards, tom lane