| From: | Surafel Temesgen <surafel3000(at)gmail(dot)com> |
|---|---|
| To: | Erik Rijkers <er(at)xs4all(dot)nl> |
| Cc: | Ryan Lambert <ryan(at)rustprooflabs(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: FETCH FIRST clause PERCENT option |
| Date: | 2019-08-19 11:11:48 |
| Message-ID: | CALAY4q_t3nUGkCrhWs3=a3ZgbcR-KCzam+6Vtgm1bYuCPT+4wQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Aug 19, 2019 at 1:55 PM Erik Rijkers <er(at)xs4all(dot)nl> wrote:
> Another little thing, not sure it's a bug:
>
> limit interprets its argument by rounding up or down as one would
> expect:
>
> table onek limit 10.4; --> gives 10 rows
> table onek limit 10.6; --> gives 11 rows
>
> but FETCH count PERCENT does not do that; it rounds always up.
>
> select * from (table onek limit 100) f fetch first 10.4 percent rows
> only; --> gives 11 rows
> select * from (table onek limit 100) f fetch first 10.6 percent rows
> only; --> gives 11 rows
>
> I see that it's documented in the .sgml to behave as it does, but it
> seems wrong to me;
> shouldn't that 10.4-percent-query yield 10 rows instead of 11?
>
>
According to sql standard we have to use the result ceiling value
regards
Surafel
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Konstantin Knizhnik | 2019-08-19 11:16:56 | Re: Global temporary tables |
| Previous Message | movead li | 2019-08-19 10:57:03 | Re: Rearranging ALTER TABLE to avoid multi-operations bugs |