Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Jan Wieck <JanWieck(at)Yahoo(dot)com>, magnus(dot)enbom(at)rockstorm(dot)se, pgsql-sql(at)postgresql(dot)org
Subject: Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?
Date: 2002-08-26 19:01:37
Message-ID: 1823.1030388497@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-08-26 19:11:04 Re: anonymous composite types - how to pass tupdesc to the function
Previous Message Lamar Owen 2002-08-26 19:01:23 Re: @(#)Mordred Labs advisory 0x0007: Remove DoS in PostgreSQL

Browse pgsql-sql by date

  From Date Subject
Next Message Magnus Enbom 2002-08-26 19:50:27 Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?
Previous Message Bruce Momjian 2002-08-26 18:53:45 Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?