Postgres Function Select Into Arraylist Sort C