Postgres Function Select Into Arraylist To Int