Hi,
I'm looking to write an aggregate of the form
compute_over_best_n ( A, B )
where I'm trying to compute a value over the first n (where n is data-
dependent) values in the input table, sorted over column A. Column B
contains supplemental information used to determine n (that is, when
to stop the aggregate). My first thought was to pass a sortop to
CREATE AGGREGATE, but the fact that I need column B prevents me from
using a sort. Is there any way to trick postgres into only sorting
over the first parameter, without getting rid of the second? Thanks.
- Oliver Kennedy