Batch insert error when unique constraint is set on multiple attributes

Originator:bill
Number:rdar://FB8780731 Date Originated:2020/10/6
Status:Open Resolved:
Product:Core Data Product Version:14
Classification:Bug Reproducible:Yes
 
Core Data batch insert returns error when batch inserting an entity with unique constraint on multiple attributes.

I have a sample code illustrating the problem:
https://github.com/billibala/BatchInsertAndUniqueConstraints

I expect the insert to goes through. 

My work around of this problem is... create an extra attribute to store the compound key there instead. Obviously this is more error prone. But it's a workaround.

I hope Core Data team can update the documentation or the, better, fix the issue.

The documentation does says we can use coma-separated list in unique constraint. https://developer.apple.com/documentation/coredata/loading_and_displaying_a_large_data_feed

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!