Re: To Postgres Devs : Wouldn't changing the select limit

Bruce Momjian <pgman@candle.pha.pa.us>

From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Jochem van Dieten <jochemd@oli.tudelft.nl>, pgsql-general@postgresql.org
Date: 2001-10-20T16:42:24Z
Lists: pgsql-hackers
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >> If you're going to do that, *please* suggest the *correct* substitution.
> >> AFAICT, our version of LIMIT m,n transposes to OFFSET m LIMIT n; but
> >> your message suggests the opposite.
> 
> > Remember, the 7.1 code was:
> 
> > ! select_limit: LIMIT select_limit_value ',' select_offset_value
> > !                       { $$ = makeList2($4, $2); }
> 
> > This was changed a few weeks ago to match MySQL, and only today removed.
> 
> Wups, you're right, I was looking at the cvs-tip code not 7.1.
> What was that about the order not being easy to remember? :-(

Confusing syntax proven!

> > However, our new message suggests the old PostgreSQL syntax, not the
> > MySQL syntax.  Optimally we should ship with this ordering for 7.2 and
> > reverse it for 7.3 or 7.4.
> 
> Actually, it seems that the message should point out *both* the
> old-Postgres and the MySQL translations.  One camp or the other
> is going to get burnt otherwise.  Maybe:
> 
> ERROR:  LIMIT #,# syntax no longer supported.  Use LIMIT # OFFSET #.
> 	If translating pre-7.2 Postgres: LIMIT m,n => LIMIT m OFFSET n
> 	If translating MySQL: LIMIT m,n => OFFSET m LIMIT n

I opted for a more generic message which makes clear the person it is
not a cut-and-past error message:
	
	test=> select * from pg_class LIMIT 1,1;
	ERROR:  LIMIT #,# syntax no longer supported.
	        Use separate LIMIT and OFFSET clauses.

That should take care of it in a flexible way.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026