     private func databaseWillChange(with event: DatabasePreUpdateEvent) {
         if savepointStack.isEmpty {
             // Notify now
-            for (observation, predicate) in activeTransactionObservations where predicate(event) {
+            for (observation, predicate) in statementObservations where predicate.evaluate(event) {
                 observation.databaseWillChange(with: event)
             }
         } else {
             // Buffer
-            savepointStack.eventsBuffer.append((event: event.copy(), observations: activeTransactionObservations))
+            savepointStack.eventsBuffer.append((event: event.copy(), statementObservations: statementObservations))
         }
     }
 #endif


#endif

typealias DatabaseEventPredicate = (DatabaseEventProtocol) -> Bool

/// The SQLite savepoint stack is described at
/// https://www.sqlite.org/lang_savepoint.html

    unowned var database: Database
    var savepointStack = SavepointStack()
    var transactionState: TransactionState = .none
    var observations = [TransactionObservation]()
    var statementObservations = [(TransactionObservation, DatabaseEventPredicate)]()
    
    init(_ database: Database) {
        self.database = database
