If someone wanted to put arbitrary aggregates into PostgreSQL, I would suggest something akin to the "RED BRICK" API, or better yet, the ATLAS API: http://magna.cs.ucla.edu/atlas/ ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend