Re: BUG #6139: LIMIT doesn't return correct result when the value is huge

Поиск
Список
Период
Сортировка
Искать
От
Alex Hunsaker
Тема
Re: BUG #6139: LIMIT doesn't return correct result when the value is huge
Дата
Msg-id
CAFaPBrReNVPn7EeZ2yonFuGiC6CU1mC6Et0Pnz7hCQNcw7V0dA@mail.gmail.com
Ответ на
Список
Дерево обсуждения
BUG #6139: LIMIT doesn't return correct result when the value is huge "Hitoshi Harada" <umi.tanuki@gmail.com>
Re: BUG #6139: LIMIT doesn't return correct result when the value is huge Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Re: BUG #6139: LIMIT doesn't return correct result when the value is huge Alex Hunsaker <badalex@gmail.com>
On Tue, Aug 2, 2011 at 00:25, Hitoshi Harada  wrote:

> db1=3D# select * from test_xy order by x LIMIT 9223372036854775807 OFFSET=
 6;
[ ...]

> db1=3D# select * from test_xy order by x LIMIT pow(2, 63);
> ERROR: =C2=A0bigint out of range
> ERROR: =C2=A0bigint out of range
>
> Maybe a parser converts literal unexpectedly?

pow(2, 63) !=3D 9223372036854775807, pow(2, 63) - 1 does :-). On top of
that pow(2, 63) seems to default to the double variant of pow() which
causes rounding issues. You probably want LIMIT pow(2, 63::numeric)-1.
В списке pgsql-bugs по дате отправления
От: Hitoshi Harada
Дата:
От: Heikki Linnakangas
Дата:
FAQ