How to get the last element of an array in PostgreSQL? September 15, 2023 by Tarik For any array “arr”, to fetch the last element of array arr use SELECT arr[array_upper(arr, 1)];