Postgres Function Select Into Arraylist Length