"Matt Magoffin" <postgresql(dot)org(at)msqr(dot)us> writes:
> Thanks very much, that helps. Now I'm wondering if it's also possible to
> then fill in another nested element level in the XML output, from the rows
> that are aggregated into the <range> count.
Something involving xmlagg in the sub-query, perhaps? No time to
experiment with it now.
regards, tom lane