]> granicus.if.org Git - postgresql/commit
Repair corner-case bug in array version of percentile_cont().
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 13 Dec 2014 16:49:20 +0000 (11:49 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 13 Dec 2014 16:49:20 +0000 (11:49 -0500)
commit9ccae6360df4a8be845e28b0ab9042ab09e8c397
treea808c0922f780da7b53e6a723e1f425b40a12936
parent1a1fb46da4ca6ac0385bdd43a33e15b64370dfdd
Repair corner-case bug in array version of percentile_cont().

The code for advancing through the input rows overlooked the case that we
might already be past the first row of the row pair now being considered,
in case the previous percentile also fell between the same two input rows.

Report and patch by Andrew Gierth; logic rewritten a bit for clarity by me.
src/backend/utils/adt/orderedsetaggs.c
src/test/regress/expected/aggregates.out
src/test/regress/sql/aggregates.sql