[release/7.0] Fix to #30996 - Incorrect translation of comparison of current value with owned type default value #31742
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Port of #31714
Fixes #30996
Description
In optional dependent table sharing scenario, when comparing the dependent to null we first look for any required properties (at least one of them needs to be null), and if we don't have any required properties we look at optional ones (even though this is somewhat ambiguous). Error was that we did similar check as with required properties (i.e. at least one of them must be null, but what we should be doing is checking that all of them are null.
Customer impact
Incorrect results for queries on optional dependent entities being compared to null, when there are no required properties.
How found
Customer report on 7.0
Regression
Yes.
Testing
Added regression tests for affected scenarios.
Risk
Small: bug is isolated to this specific scenario (optional dependent entities with no required properties being compared to null). Fix returns the behavior to be identical to 6.0 - where it was working correctly. Also added quirk to revert to old behavior if necessary.