code: func IsDataException(err error) bool {
  	if err == nil {
  		return false
  	}
  	pqError, ok := err.(*pq.Error)
  	return ok && pqError.Code[:2] == errDataException
  }
docs: // IsDataException returns true if the error is of type data exception (eg: type
  // mismatch, invalid delimiter, divide by zero, ...)
  // See https://www.postgresql.org/docs/current/static/errcodes-appendix.html