On 25/11/2018 12:49, Surafel Temesgen wrote: > > > On Sun, Nov 25, 2018 at 1:24 PM Vik Fearing <vik.fear...@2ndquadrant.com > <mailto:vik.fear...@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