Postgres Aggregate Into Arraylist Sorting