Re: FETCH FIRST clause PERCENT option

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: FETCH FIRST clause PERCENT option
Дата
Msg-id 782a231d-47c3-78ee-10c6-a3853ef6c691@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: FETCH FIRST clause PERCENT option  (Surafel Temesgen <surafel3000@gmail.com>)
Ответы Re: FETCH FIRST clause PERCENT option  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Re: FETCH FIRST clause PERCENT option  (Surafel Temesgen <surafel3000@gmail.com>)
Список pgsql-hackers
On 25/11/2018 12:49, Surafel Temesgen wrote:
> 
> 
> On Sun, Nov 25, 2018 at 1:24 PM Vik Fearing <vik.fearing@2ndquadrant.com
> <mailto:vik.fearing@2ndquadrant.com>> wrote:
> 
> 
>     Also, this query returns 210 rows instead of the expected 208:
> 
>         select *
>         from generate_series(1, 1000)
>         fetch first 20.8 percent rows only
> 
> this is because fetch first values work with integer and it change
> fractional number to nearest integer number like select * from
> generate_series(1, 1000) fetch first 20.3 rows only; is not an error
> rather it return 20 rows.

I don't see how this behavior is justified by reading the SQL standard.
 Obviously only an integer number of rows is going to be returned, but
the percentage should be calculated correctly.

I assume you meant 200 rows there, but the correct number of rows to
return is 203 for that query.  Please fix it.
-- 
Vik Fearing                                          +33 6 46 75 15 36
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


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

Предыдущее
От: Surafel Temesgen
Дата:
Сообщение: Re: FETCH FIRST clause PERCENT option
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: RHEL 8.0 build