diff --git a/GRDB/QueryInterface/Request/CommonTableExpression.swift b/GRDB/QueryInterface/Request/CommonTableExpression.swift index 3edff0e24..eca5e4838 100644 --- a/GRDB/QueryInterface/Request/CommonTableExpression.swift +++ b/GRDB/QueryInterface/Request/CommonTableExpression.swift @@ -88,7 +88,11 @@ extension CommonTableExpression { extension _FetchRequest { #warning("TODO: doc") - public func commonTableExpression(tableName: String) -> CommonTableExpression { + public func commonTableExpression( + tableName: String, + type: RowDecoder.Type = RowDecoder.self) + -> CommonTableExpression + { CommonTableExpression( tableName: tableName, request: self) diff --git a/Tests/GRDBTests/CommonTableExpressionTests.swift b/Tests/GRDBTests/CommonTableExpressionTests.swift index 310d9900d..f0bc032e3 100644 --- a/Tests/GRDBTests/CommonTableExpressionTests.swift +++ b/Tests/GRDBTests/CommonTableExpressionTests.swift @@ -12,8 +12,8 @@ class CommonTableExpressionTests: GRDBTestCase { // Just add a WITH clause: query interface request do { enum CTE { } - let cte: CommonTableExpression = T.all() - .commonTableExpression(tableName: "cte") + let cte = T.all() + .commonTableExpression(tableName: "cte", type: CTE.self) let request = T.all() .with(cte) try assertEqualSQL(db, request, """