If someone wanted to put arbitrary aggregates into PostgreSQL, I wouldsuggest something akin to the "RED BRICK" API, or better yet, the ATLASAPI:http://magna.cs.ucla.edu/atlas/