Add SQL for postgres, and fail gracefully in populateIpChanges