CommonTableExpression is a table, after all

This commit is contained in:
Gwendal Roué committed 2020-11-30 19:21:46 +01:00
1 parent 755782759a
commit ec2640a459
7 files changed
+154 -184

No files matched your search

@@ -273,9 +273,6 @@ extension QueryInterfaceRequest: TableRequest {
// request.filter(keys: ...)
// request.orderByPrimaryKey()
return tableName
case .commonTableExpression:
#warning("TODO: is this ok?")
fatalError("Request is not based on a database table")
case .subquery:
// The only current use case for SQLSource.query is the
// "trivial count query" (see SQLQuery.countQuery):
@@ -341,7 +338,7 @@ extension QueryInterfaceRequest {
#warning("TODO: doc")
public func with(_ cte: CommonTableExpression) -> Self {
map(\.query) { $0.with(\.ctes[cte.key], cte) }
map(\.query) { $0.with(\.ctes[cte.tableName], cte.request) }
}
/// Creates a request bound to type RowDecoder.