Postgresql Loop Through Array Backwards Question