9.4rc bug in percentile_cont

Started by Andrew Gierthover 11 years ago2 messageshackers
Jump to latest
#1Andrew Gierth
andrew@tao11.riddles.org.uk

Just got a report on IRC of a bug in the array version of
percentile_cont; if two of the requested percentiles were between the
same pair of input rows, the result could be wrong or an error would
be generated.

e.g.

select percentile_cont(array[0.4,0.6]) within group (order by gs)
from generate_series(1,2) gs;
ERROR: missing row in percentile_cont

Proposed patch (against current master) attached.

--
Andrew (irc:RhodiumToad)

Attachments:

pcontfix.patchtext/x-patchDownload+21-12
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Gierth (#1)
Re: 9.4rc bug in percentile_cont

Andrew Gierth <andrew@tao11.riddles.org.uk> writes:

Just got a report on IRC of a bug in the array version of
percentile_cont; if two of the requested percentiles were between the
same pair of input rows, the result could be wrong or an error would
be generated.

Oooh, good catch.

Proposed patch (against current master) attached.

I think this patch could be improved a bit; will work on it.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers