Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1? - Mailing list pgsql-sql

From Tom Lane
Subject Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?
Date
Msg-id 1823.1030388497@sss.pgh.pa.us
Whole thread Raw
In response to Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-sql
Bruce Momjian <pgman@candle.pha.pa.us> 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


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?
Next
From: Magnus Enbom
Date:
Subject: Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?