Re:custom aggregate:
I'd probably try building a two dimensional array in the state transition
function. Take the new value and check if it is adjacent to the last value
in the last bin of the current state. If so add it to that bin. If not
create a new bin and store it there. Requires sorted input.
You could also just store all the values encountered and at the end group
them into bins after sorting internally. That way you just need to get the
partition right - not the order by and sub-groups.
The final output is just a call to string_agg though you would have to
unnest the array in a custom manner since unnest() flattens
multiple-dimensional arrays. See a recent thread for specifics.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Grouping-Aggregate-Min-Max-tp5783279p5783318.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.