Postgresql Plpgsql Loop Through Array Jquery Interview