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

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Jan Wieck <JanWieck(at)Yahoo(dot)com>
Cc: 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 18:53:45
Message-ID: 200208261853.g7QIrjP16253@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Jan Wieck wrote:
> Bruce Momjian wrote:
> >
> > I found this email from April. It properly points out that our
> > LIMIT/FOR UPDATE ordering doesn't match MySQL's, and MySQL's looks more
> > correct, specifically that the FOR UPDATE is after the LIMIT. Our
> > grammar is:
>
> How do you define "correct" for "non-standard" features? And why don't
> you ask Monty first to change to our "de-facto-standard"? ;-)

Well, MySQL created LIMIT, so they have the right to define the
standard. 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.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lamar Owen 2002-08-26 19:01:23 Re: @(#)Mordred Labs advisory 0x0007: Remove DoS in PostgreSQL
Previous Message Thomas O'Connell 2002-08-26 18:52:28 Re: PostgreSQL 7.2.2: Security Release

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-08-26 19:01:37 Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?
Previous Message Jan Wieck 2002-08-26 18:42:26 Re: LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?