code: func (q *Query) SelectOrInsert(values ...interface{}) (inserted bool, _ error) {
  	if q.stickyErr != nil {
  		return false, q.stickyErr
  	}
  
  	var insertq *Query
  	var insertErr error
  	for i := 0; i < 5; i++ {
  		if i >= 2 {
  			time.Sleep(internal.RetryBackoff(i-2, 250*time.Millisecond, 5*time.Second))
  		}
  
  		err := q.Select(values...)
  		if err == nil {
  			return false, nil
  		}
  		if err != internal.ErrNoRows {
  			return false, err
  		}
  
  		if insertq == nil {
  			insertq = q
  			if len(insertq.columns) > 0 {
  				insertq = insertq.Copy()
  				insertq.columns = nil
  			}
  		}
  
  		res, err := insertq.Insert(values...)
  		if err != nil {
  			insertErr = err
  			if err == internal.ErrNoRows {
  				continue
  			}
  			if pgErr, ok := err.(internal.PGError); ok {
  				if pgErr.IntegrityViolation() {
  					continue
  				}
  				if pgErr.Field('C') == "55000" {
  					// Retry on "#55000 attempted to delete invisible tuple".
  					continue
  				}
  			}
  			return false, err
  		}
  		if res.RowsAffected() == 1 {
  			return true, nil
  		}
  	}
  
  	err := fmt.Errorf(
  		"pg: SelectOrInsert: select returns no rows (insert fails with err=%q)",
  		insertErr)
  	return false, err
  }
docs: // SelectOrInsert selects the model inserting one if it does not exist.
  // It returns true when model was inserted.