         //          row.scopes["author"] // [id:12, name:"Herman Melville"]
         //          let author: Author = row["author"]
         //      }
-        let rangeAdapter = RangeRowAdapter(startIndex ..< (startIndex + selectionWidth))
+        let rangeAdapter = RangeRowAdapter(startIndex ..< (startIndex + sourceSelectionWidth))
         let adapter = rangeAdapter.addingScopes(scopes)
         
         return (adapter: adapter, endIndex: endIndex)

    /// Removes all selections from joins
    func selectOnly(_ selection: [SQLSelectable]) -> SQLQualifiedRelation {
        var relation = self
        relation.ownSelection = selection.map { $0.qualifiedSelectable(with: alias) }
        relation.joins = relation.joins.mapValues { $0.selectOnly([]) }
        return relation
    }


/// A "qualified" relation, where all tables are identified with a table alias.
///
///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
///            |        |        |         |            |
///            |        |        |         |            • ordering
///            |        |        |         • filterPromise
///            |        |        • joins
///            |        • source
///            • selection
private struct SQLQualifiedRelation {
    /// The source alias
    var alias: TableAlias { return source.alias }
    
    /// All aliases, including aliases of joined relations
    var allAliases: [TableAlias] {
        return joins.reduce(into: source.allAliases) {
            $0.append(contentsOf: $1.value.relation.allAliases)
        }
    }
    
    /// The source
    ///
    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
    ///                     |
    ///                     • source
    let source: SQLQualifiedSource
    
    /// The selection from source, not including selection of joined relations
    private var sourceSelection: [SQLSelectable]
    
    /// The full selection, including selection of joined relations
    ///
    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
    ///            |
    ///            • selection
    var selection: [SQLSelectable] {
        return joins.reduce(into: sourceSelection) {
            $0.append(contentsOf: $1.value.relation.selection)
        }
    }
    
    /// The filtering clause
    ///
    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
    ///                                        |
    ///                                        • filtersPromise
    let filtersPromise: DatabasePromise<[SQLExpression]>
    
    /// The ordering of source, not including ordering of joined relations
    private let sourceOrdering: SQLRelation.Ordering
    
    /// The full ordering, including orderings of joined relations
    ///
    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
    ///                                                     |
    ///                                                     • ordering
    var ordering: SQLRelation.Ordering {
        return joins.reduce(sourceOrdering) {
            $0.appending($1.value.relation.ordering)
        }
    }
    
    /// The joins
    ///
    ///     SELECT ... FROM ... JOIN ... WHERE ... ORDER BY ...
    ///                              |
    ///                              • joins
    private(set) var joins: OrderedDictionary<String, SQLQualifiedJoin>
    
    init(_ relation: SQLRelation) {
