     }
     
     func makeDeleteStatement(_ db: Database) throws -> UpdateStatement {
-        if let groupExpressions = try groupPromise?.resolve(db), !groupExpressions.isEmpty {
+        switch try grouping(db) {
+        case .none:
+            break
+        case .unique:
+            return try makeTrivialDeleteStatement(db)
+        case .nonUnique:
             // Programmer error
             fatalError("Can't delete query with GROUP BY clause")
-        }
-        
-        guard havingExpressions.isEmpty else {
-            // Programmer error
-            fatalError("Can't delete query with HAVING clause")
-        }
-        
-        guard relation.joins.isEmpty else {
-            // Programmer error
-            fatalError("Can't delete query with JOIN clause")
         }
         
         guard case .table = relation.source else {
             // Programmer error
             fatalError("Can't delete without any database table")
+        }
+        
+        guard relation.joins.isEmpty else {
+            return try makeTrivialDeleteStatement(db)
         }
         
         var context = SQLGenerationContext.queryGenerationContext(aliases: relation.allAliases)

            }
            sql += " LIMIT " + limit.sql
        }
        
        let statement = try db.makeUpdateStatement(sql: sql)
        statement.arguments = context.arguments!

        assignments: [ColumnAssignment])
        throws -> UpdateStatement?
    {
        switch try grouping(db) {
        case .none:
            break
        case .unique:
            return try makeTrivialUpdateStatement(db, conflictResolution: conflictResolution, assignments: assignments)
        case .nonUnique:
            // Programmer error
            fatalError("Can't update query with GROUP BY clause")
        }
        
        guard case .table = relation.source else {
            // Programmer error
            fatalError("Can't update without any database table")
        }
        
        guard relation.joins.isEmpty else {
            return try makeTrivialUpdateStatement(db, conflictResolution: conflictResolution, assignments: assignments)
        }
        
        if assignments.isEmpty {
