Testing db constraints and retrieving postgres error messages.