Skip to content

Commit

Permalink
Restore tests by disabling a sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
groue committed Mar 6, 2019
1 parent 5d9fa76 commit 7ff2198
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions GRDB/QueryInterface/SQLSelectable+QueryInterface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,27 @@ extension QualifiedAllColumns : SQLSelectable {
}

func countedSQL(_ context: inout SQLGenerationContext) -> String {
if context.qualifier(for: alias) != nil {
// SELECT COUNT(t.*) is invalid SQL
fatalError("Not implemented, or invalid query")
}
// TODO: restore the check below.
//
// It is currently disabled because of AssociationAggregateTests.testHasManyIsEmpty:
//
// let request = Team.having(Team.players.isEmpty)
// try XCTAssertEqual(request.fetchCount(db), 1)
//
// This should build the trivial count query `SELECT COUNT(*) FROM (SELECT ...)`
//
// Unfortunately, we don't support anonymous table aliases that would be
// required here. Because we don't support anonymous tables aliases,
// everything happens as if we wanted to generate
// `SELECT COUNT(team.*) FROM (SELECT ...)`, which is invalid SQL.
//
// So let's always return `*`, and fix this later.

// if context.qualifier(for: alias) != nil {
// // SELECT COUNT(t.*) is invalid SQL
// fatalError("Not implemented, or invalid query")
// }

return "*"
}

Expand Down

0 comments on commit 7ff2198

Please sign in to comment.