Re: Negative LIMIT and OFFSET?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Neil Conway <neilc(at)samurai(dot)com>, Andrew Sullivan <ajs(at)crankycanuck(dot)ca>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Negative LIMIT and OFFSET?
Date: 2008-03-10 03:40:30
Message-ID: 28193.1205120430@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> On Thu, 2007-12-13 at 22:23 -0800, Neil Conway wrote:
>> If "LIMIT n" means "emit at most n tuples", then a query that produces 0
>> rows with n < 0 is arguably violating its spec, since it has produced
>> more tuples than the LIMIT specified (0 > n). Interpreted this way, no
>> result set can be consistent with a negative limit, so I'd vote for
>> throwing an error.

> I even found an existing, unused error message called
> ERRCODE_INVALID_LIMIT_VALUE

> so here's a patch.

Applied, but using just ERRCODE_INVALID_PARAMETER_VALUE rather than
guessing what the SQL committee intended with that SQLSTATE.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kris Jurka 2008-03-10 05:42:01 Need -fwrapv or -fno-strict-overflow for gcc-4.3
Previous Message Tom Lane 2008-03-10 03:03:37 Re: Include Lists for Text Search