Postgresql Loop Through Array Powershell If Elseif Else Statement