Skip site navigation (1) Skip section navigation (2)

Re: Negative LIMIT and OFFSET?

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Negative LIMIT and OFFSET?
Date: 2007-12-14 01:47:23
Message-ID: 87lk7ym4ic.fsf@oxford.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-hackers
"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.

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com
  Ask me about EnterpriseDB's On-Demand Production Tuning

In response to

Responses

pgsql-hackers by date

Next:From: Andrew SullivanDate: 2007-12-14 02:43:28
Subject: Re: Negative LIMIT and OFFSET?
Previous:From: Simon RiggsDate: 2007-12-14 01:19:01
Subject: Negative LIMIT and OFFSET?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group