On Thu, 2007-12-13 at 22:06 -0500, Tom Lane wrote:
> Hmm ... I don't recall much either. The code in nodeLimit.c just
> silently replaces a negative input value by zero. It'd certainly be
> possible to make it throw an error instead, but what the downsides of
> that might be aren't clear.
> I guess that on purely philosophical grounds, it's not an unreasonable
> behavior. For example, "LIMIT n" means "output at most n tuples",
> not "output exactly n tuples". So when it outputs no tuples in the face
> of a negative limit, it's meeting its spec.
Not bothered either way, really, just reporting weirdness as it comes.
A calculated LIMIT value that was negative probably indicates an error
in the calculation that the SQL programmer may wish to know about. I had
previously assumed that we would report such errors.
> If you want to throw an
> error for negative limit, shouldn't you logically also throw an error
> for limit larger than the actual number of rows produced by the subplan?
No, thats another feature AT LEAST n, which could also be a useful
thing, like an Assert.
In response to
pgsql-hackers by date
|Next:||From: Markus Schiltknecht||Date: 2007-12-14 09:39:40|
|Subject: Re: [GENERAL] Slow PITR restore|
|Previous:||From: Gregory Stark||Date: 2007-12-14 09:02:04|
|Subject: Re: Negative LIMIT and OFFSET?|