]> 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:16 +0000 (11:49 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 13 Dec 2014 16:49:41 +0000 (11:49 -0500)
commitb0f479113abaf28f1c9ed25d856ffe6fd4bb7dc9
tree50f883e1cf945a912e97d844cde8500e437dcfcd
parent50f2c0687fabde9c665df66f77b464c539d927a9
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