Postgresql Get Last Element In Arraylist