Check for unique constraint violation