NSFetchRequest includesPendingChanges acts unexpectedly with nested MO contexts

Originator:me
Number:rdar://11024447 Date Originated:09-Mar-2012 06:21 PM
Status:Open Resolved:
Product:Mac OS X Product Version:10.7.3 (11D50)
Classification:Other Bug Reproducible:Always
 
The 'includesPendingChanges' flag on NSFetchRequest is documented to "match against currently unsaved changes in the managed object context".

When this is set to NO in a nested managed object context, this instead runs against what's on disk, excluding changes that have been saved from the perspective of the child MOC. This is unexpected behavior.

I can think of two subtly distinct uses for this flag: The first would be "ignore changes that are pending (in _this current_ context)". The second is "run this query against indexes only, avoiding a linear scan of uncommitted objects". Currently these two meanings are conflated, with the actual result being "run the fetch directly against the persistent store (what's on disk)".

One solution is to split into two flags. At least, the documentation should clarify the behavior.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!