Re: FETCH FIRST clause PERCENT option - Mailing list pgsql-hackers

From Tom Lane
Subject Re: FETCH FIRST clause PERCENT option
Date
Msg-id 11184.1543170668@sss.pgh.pa.us
Whole thread Raw
In response to Re: FETCH FIRST clause PERCENT option  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> On 11/25/18 1:05 PM, Vik Fearing wrote:
>> 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.

> Right. My draft of SQL standard says this:
> 31) The declared type of the <simple value specification> simply
> contained in <fetch first percentage> shall be numeric.

> So the standard pretty much requires treating the value as numeric.

Note that this should not be read as "it must be of the type that PG
calls numeric".  I'd read it as requiring a value that's in the numeric
type hierarchy.  float8 would be a reasonable implementation choice
if we're going to coerce to a specific type.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Continue work on changes to recovery.conf API
Next
From: Stephen Frost
Date:
Subject: Re: Updated backup APIs for non-exclusive backups