Commits

Tuukka Norri committed 2e315af

Made an optimization conditional
- Added a flag to BXEntityDescription, which indicates, whether the entity will be changed "externally" by triggers, rules, etc.
- Changed the database context and PG adapter so that if the flag is set, changes done even by the current context will be checked from the database. Earlier, INSERT, UPDATE and DELETE wouldn't cause modification tables to be queried by the issuing connection in any case. This would, however, cause changes made in triggers etc. to be ignored by that connection (that also caused the trigger to fire).
- This is still an experimental feature.

Comments (0)

Files changed (1)

Framework/Sources/PGTSNotifier.m

 - (void) removeObserverForTable: (PGTSTableInfo *) tableInfo
 			   notificationName: (NSString *) notificationName
 {
-    [[tableInfo retain] autorelease];
-	[postedNotifications removeObject: notificationName];
-	if (0 == [postedNotifications countForObject: notificationName])
-		[[NSNotificationCenter defaultCenter] removeObserver: delegate name: notificationName object: tableInfo];
-    [observedTables removeObject: tableInfo];
-	[lastChecks removeObjectForKey: [notificationNames objectAtIndex: [tableInfo oid]]];
-    [self removeNotificationIfNeeded: tableInfo];
+	if ([postedNotifications containsObject: notificationName])
+	{
+		[[tableInfo retain] autorelease];
+		[postedNotifications removeObject: notificationName];
+		if (0 == [postedNotifications countForObject: notificationName])
+			[[NSNotificationCenter defaultCenter] removeObserver: delegate name: notificationName object: tableInfo];
+		[observedTables removeObject: tableInfo];
+		[lastChecks removeObjectForKey: [notificationNames objectAtIndex: [tableInfo oid]]];
+		[self removeNotificationIfNeeded: tableInfo];
+	}
 }
 
 - (void) removeNotificationIfNeeded: (PGTSTableInfo *) tableInfo