Negative LIMIT and OFFSET? - Mailing list pgsql-hackers

From Simon Riggs
Subject Negative LIMIT and OFFSET?
Date
Msg-id 1197595141.15521.10.camel@ebony.site
Whole thread Raw
Responses Re: Negative LIMIT and OFFSET?  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
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...

postgres=# select * from accounts limit -9;aid | bid | abalance | filler 
-----+-----+----------+--------
(0 rows)

Time: 0.330 ms
postgres=# select * from accounts limit -9 offset 45;aid | bid | abalance | filler 
-----+-----+----------+--------
(0 rows)

Time: 0.268 ms
postgres=# select * from accounts limit -9 offset -100000;aid | bid | abalance | filler 
-----+-----+----------+--------
(0 rows)

Time: 0.287 ms

postgres=# select * from accounts limit 0 offset -100000;aid | bid | abalance | filler 
-----+-----+----------+--------
(0 rows)

Time: 0.289 ms

--  Simon Riggs 2ndQuadrant  http://www.2ndQuadrant.com



pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: [GENERAL] Slow PITR restore
Next
From: Gregory Stark
Date:
Subject: Re: Negative LIMIT and OFFSET?