diff --git a/GRDB/QueryInterface/Association/Association.swift b/GRDB/QueryInterface/Association/Association.swift index 0d3781238..f9666c953 100644 --- a/GRDB/QueryInterface/Association/Association.swift +++ b/GRDB/QueryInterface/Association/Association.swift @@ -360,9 +360,7 @@ extension Association where OriginRowDecoder: MutablePersistableRecord { .filter { db in // Build a join condition: `association.recordId = record.id` // We still need to replace `record.id` with the actual record id. - guard let joinExpression = try self._impl.joinCondition.sqlExpression(db, leftAlias: recordAlias, rightAlias: associationAlias) else { - fatalError("Can't request from record without join condition") - } + let joinExpression = try self._impl.joinCondition.sqlExpression(db, leftAlias: recordAlias, rightAlias: associationAlias) // Serialize record: ["id": 123, ...] // We do it as late as possible, when request is about to be diff --git a/GRDB/QueryInterface/SQLSelectQuery.swift b/GRDB/QueryInterface/SQLSelectQuery.swift index 21e15f808..94304673b 100644 --- a/GRDB/QueryInterface/SQLSelectQuery.swift +++ b/GRDB/QueryInterface/SQLSelectQuery.swift @@ -1,4 +1,4 @@ -/// The SQLSelectQuery generates SQL for query interface requests. +/// SQLSelectQuery generates SQL for query interface requests. struct SQLSelectQuery { var relation: SQLRelation var isDistinct: Bool @@ -424,7 +424,7 @@ public /* TODO: internal */ struct JoinCondition: Equatable { /// - parameter rightAlias: A TableAlias for the table on the right of the /// JOIN operator. /// - Returns: An SQL expression. - func sqlExpression(_ db: Database, leftAlias: TableAlias, rightAlias: TableAlias) throws -> SQLExpression? { + func sqlExpression(_ db: Database, leftAlias: TableAlias, rightAlias: TableAlias) throws -> SQLExpression { let foreignKeyMapping = try foreignKeyRequest.fetch(db).mapping let columnMapping: [(left: Column, right: Column)] if originIsLeft {