Postgres 8.4 can't handle ORDER BY within array_agg(); alter query to order column names without using that