withTransactionModeRetry previously would retry if a not_serializable exception
was thrown, but this can be a little too fine grained. There are cases when a
transaction should be retried when a unique_violation occurs (e.g., a race
condition occurs). This allows users to tune the retrying semantics to the
needs of their application.