Re: Negative LIMIT and OFFSET?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Negative LIMIT and OFFSET?
Date: 2007-12-17 02:07:28
Message-ID: 200712170207.lBH27Tv10749@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark wrote:
>
> "Simon Riggs" <simon(at)2ndquadrant(dot)com> writes:
>
> > I'm fairly surprised these queries work. Is there some reason why we
> > support this? April Fools Day? Jules Verne? I'm all for fast queries,
> > but zero seems like the lowest value we should support...
>
> Huh, I was all set to post an example of a useful application of it but then
> apparently I'm wrong and it doesn't work:
>
> postgres=# select * from generate_series(1,10) offset -1 limit 2;
> generate_series
> -----------------
> 1
> 2
> (2 rows)
>
> I'll leave it as an exercise for the reader to guess what I was expecting.
>
> So given that that doesn't work I don't see any particular reason to accept
> negative offsets or limits in 8.4 and on.

Since we got LIMIT/OFFSET from MySQL, would someone tell us how MySQL
behaves in these cases?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-12-17 04:54:51 Re: Negative LIMIT and OFFSET?
Previous Message Bruce Momjian 2007-12-17 02:01:24 Re: pgindent issue with EXEC_BACKEND-only typedefs