Skip to content
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

Je/fix upgrade #3854

Merged
merged 3 commits into from
Aug 19, 2020
Merged

Je/fix upgrade #3854

merged 3 commits into from
Aug 19, 2020

Conversation

jedelbo
Copy link
Contributor

@jedelbo jedelbo commented Aug 17, 2020

Fixes #3836

@jedelbo jedelbo requested a review from finnschiermer August 17, 2020 13:10
l.add(from_list.get_legacy(j));
auto val = from_list.get_legacy(j);
if (val.is_null() && !nullable) {
// Be forgiving about this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should we be forgiving about this? Isn't it better to just throw a better exception that describe what is wrong?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error was also reported in Java here: realm/realm-java#6995 (comment)

It does feel slightly worrying if a list not allowed to contain Nulls do contain Nulls though? Any idea how this could happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to actually upgrade the file. If we just throw, there is nothing the user can do to fix the situation. I have not checked the core-5 code - yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm wondering how it is possible to come in this situation where the column is marked as not-null, but still contains null values? Doesn't that indicate another bug somewhere?

But agree that if there is nothing the user can do, then it is better to attempt to fix it instead of just leaving a broken Realm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looked at it once more. Found another solution that actually returns the right value from list. Not sure if it is nicer.

Copy link
Contributor

@finnschiermer finnschiermer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add tests for this? Otherwise LGTM

@jedelbo jedelbo merged commit 9698ec0 into master Aug 19, 2020
@jedelbo jedelbo deleted the je/fix-upgrade branch August 19, 2020 08:46
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Attempted to insert null into non-nullable column" when upgrading from v9 to v10
3 participants