       // specify the attributes manually.
       if let n = self.targetAttributeName     { targetAttributeName = n    }
       else if let pkey = targetPrimaryKeyName { targetAttributeName = pkey }
-      else                                    { return nil                 }
+      else { throw JoinCalculationError.toOneHasNoTargetAttribute }
       
       if let n = self.sourceAttributeName     { sourceAttributeName = n    }
       else {

    }
  }

  // helpers
  
  var sourcePrimaryKeyName : String? {
    guard let pkeys = entity.primaryKeyAttributeNames else { return nil }

        if let sourceA = entity[attribute: sourceAttributeName] {
          // The primary key _column_ of the target, e.g. `company_id`
          // Do we have this as the column? (aka foreign key)?
          // But what if we name the columns 'id' in the database too. Say
          // Person.id and Address.id. We wouldn't want to match those?!
          
          let colname = sourceA.columnName ?? sourceA.name
          if let targetA = destinationEntity?[columnName: colname] {
            targetAttributeName = targetA.name
          }
          else {
            // OK, we hit this if both pkeys are named 'id'
            
            print("source attr is:", sourceA)
            throw JoinCalculationError.toManyCouldNotDeriveTargetAttribute(
              entityName: self.name, column: colname, sourceAttribute: sourceA,
              destinationEntity: destinationEntity
            )
          }
        }
        else {
          throw JoinCalculationError.toManyDidNotFindSourceAttribute(
                                       sourceAttributeName: sourceAttributeName)
        }
      }
    }
