Postgresql Loop Through Array Backwards Design Example