Postgresql Loop Through Array Backwards Recorder