Is there a way to run a check in PostgreSQL to validate each of the records when there is bad records or etc?