get last element postgress with index code example Example: postgresql array last element arr[array_length(arr, 1)]