Re: Negative LIMIT and OFFSET?

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: Negative LIMIT and OFFSET?
Дата
Msg-id 1197643309.15521.116.camel@ebony.site
обсуждение исходный текст
Ответ на Re: Negative LIMIT and OFFSET?  (Neil Conway <neilc@samurai.com>)
Ответы Re: Negative LIMIT and OFFSET?  (Simon Riggs <simon@2ndquadrant.com>)
Re: Negative LIMIT and OFFSET?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Negative LIMIT and OFFSET?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Thu, 2007-12-13 at 22:23 -0800, Neil Conway wrote:
> On Thu, 2007-12-13 at 22:06 -0500, Tom Lane wrote:
> > 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.
>
> 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.

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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Markus Schiltknecht
Дата:
Сообщение: Re: [GENERAL] Slow PITR restore
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: pgwin32_open returning EINVAL