Closed sstillwell closed 6 years ago
Thank you. This is indeed a bug in the ajrdatabase framework. It occurs with EOGenericRecord only I believe. I have to admit I rarely use EOGenericRecords and if I do, they are typically read only. I'll investigate more deeply and see if I can determine what exactly is going on.
Makes sense - I was able to add and delete a Region without issue, and they use a custom class rather than EOGenericRecord, which tends to confirm your assumption.
I updated removeObject:fromPropertyWithKey: in NSObject-EORelationshipManipulation.m which was not handling this correctly for EOGenericObject. I tested the example app Countries and is seems to have done the trick. Funny thing is the CORRECT code was there, but had been commented out by a contributor. I pushed the change up. I need to do more testing here to verify that there are no adverse effects, but my initial tests indicate that it does NOT break anything.
Confirmed that this issue no longer occurs for both MySQL and PostgreSQL with the stated test scenario. Thank you! Close the issue at your convenience.
To reproduce:
Load the demo SQL script into MySQL database, making sure the model is correctly pointing to the right database and credentials
Compile and run the demo
Select the North America region
Add a new country "ZZZ", "ZZ", "ZZ Test Country"
Country appears as expected.
Select the row for country ZZZ
Delete the row
Result: ALL countries in North America disappear from the array/list. Navigating away from North America and back does not alter this. Quitting the application and restarting shows that the other rows are still in the database and that only ZZZ was actually deleted.
This behavior happens using both PostgreSQL and MySQL, so I don't think it's an issue with the PostgreSQL adaptor. The problem may be in the example app rather than ajrdatabase itself, however.