          sql = []
          alias_str = '' if self.table_alias == self.table_name else (' %s' % self.table_alias)
          qn = compiler.quote_name_unless_alias
          qn2 = connection.ops.quote_name
          sql.append('%s %s%s ON (' % (self.join_type, qn(self.table_name), alias_str))
          for index, (lhs_col, rhs_col) in enumerate(self.join_cols):
              if index != 0:
                  sql.append(' AND ')
              sql.append('%s.%s = %s.%s' % (
                  qn(self.parent_alias),
 
</s> remove             if index != 0:
                sql.append(' AND ')
            sql.append('%s.%s = %s.%s' % (
 </s> add             join_conditions.append('%s.%s = %s.%s' % ( </s> remove         sql = []
        alias_str = '' if self.table_alias == self.table_name else (' %s' % self.table_alias)
 </s> add  </s> remove             sql.append('%s' % extra_sql)
        sql.append(')')
        return ' '.join(sql), params
 </s> add         if not join_conditions:
            # This might be a rel on the other end of an actual declared field.
            declared_field = getattr(self.join_field, 'field', self.join_field)
            raise ValueError(
                "Join generated an empty ON clause. %s did not yield either "
                "joining columns or extra restrictions." % declared_field.__class__
            )
        on_clause_sql = ' AND '.join(join_conditions)
        alias_str = '' if self.table_alias == self.table_name else (' %s' % self.table_alias)
        sql = '%s %s%s ON (%s)' % (self.join_type, qn(self.table_name), alias_str, on_clause_sql)
        return sql, params </s> remove             extra_sql = 'AND (%s)' % extra_sql
 </s> add             join_conditions.append('(%s)' % extra_sql)
        # Add a join condition for each pair of joining columns.
          sql = []
          alias_str = '' if self.table_alias == self.table_name else (' %s' % self.table_alias)
          qn = compiler.quote_name_unless_alias
          qn2 = connection.ops.quote_name
        # Add a join condition for each pair of joining columns.
          for index, (lhs_col, rhs_col) in enumerate(self.join_cols):
              if index != 0:
                  sql.append(' AND ')
              sql.append('%s.%s = %s.%s' % (
                  qn(self.parent_alias),
keep keep keep keep replace keep keep keep keep keep
 Fixed #25064 -- Allowed empty join columns. 
django/db/models/sql/datastructures.py