On Mar 13, 2011, at 3:08 PM, Gideon King wrote:

> I'm seeing a strange thing with a predicate. When I apply the predicate to a 
> fetch request, it doesn't return any results, but when I do the fetch without 
> the predicate and then use filteredArrayUsingPredicate to filter the results, 
> it has the matching row that I expect.
...
> I am really mystified by this - I can't understand why it would not work when 
> applied to a fetch request, but would work when applied to the array of 
> results.
> 
> Any suggestions?



Well, in general, sending executeFetchRequest to the context and performing a 
predicate upon a result set, behaves not (always) the same, respectively 
certain requirements must be met. 

In case of SQLite as the datastore, if you sent executeFetchRequest to the 
context, the context constructs corresponding SQL Select commands which are 
sent to SQLite and performed by SQLite itself. First of all, fetch request 
including the predicate must be convertible to equivalent SQL statements. Then, 
the SQL statements must be valid of course, and this requires (for instance) 
that all attributes within the predicate exist as fields in the corresponding 
table in the database.



Do you use a SQLite data store and is the attribute transient or is there a 
value transformer attached to it?



Regards
Andreas

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to