-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter out case-insensitive duplicate properties #6503
Conversation
@@ -36,4 +37,19 @@ class DatabaseEntitiesRepositoryTest : EntitiesRepositoryTest() { | |||
repository.save("things", savedEntity) | |||
assertThat(repository.getEntities("things")[0], sameEntityAs(savedEntity)) | |||
} | |||
|
|||
@Test | |||
fun `#save ignores case-insensitive duplicate properties`() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the conversation on Slack, it looks like we want this to be a feature of entities in general, so I think this should move to EntitiesRepostitoryTest
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Marking this as "needs testing" early as the requested changes are just for tests. |
In that Slack conversation, I had some questions about whether we should do this at all given how surprising the outcome is. I think our only real alternative would be to throw an exception when processing. The advantage of an exception is that it would at least tell the user that something unexpected happened. But given that we're very likely going to address the issue on the server side, this case would only be for other hypothetical servers. Let's go with it. |
b16c5e7
to
b935a93
Compare
Tested with Success Verified on device with Android 15 Verified cases:
|
Tested with Success Verified on device with Android 10 |
Closes #6501
Why is this the best possible solution? Were any other approaches considered?
The real issue here is that SQLite is case-insensitive, so attempting to add columns with names like
col
andCol
results in an exception. I don't think we need to implement any special handling for this, as it doesn't make much sense to add such properties in the first place. Therefore, I believe filtering out duplicates is a good solution.How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
It should be enough to test entities with duplicate properties like
col
andCol
.Do we need any specific form for testing your changes? If so, please attach one.
No.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest
(or./gradlew testLab
) and confirmed all checks still passDateFormatsTest