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

[release/8.0] Revert behavior to throw when attempting to modify an unconstrained alternate key property #32523

Merged
merged 2 commits into from
Jan 3, 2024

Conversation

ajcvickers
Copy link
Member

@ajcvickers ajcvickers commented Dec 5, 2023

Fixes #32383
Port of #32492

Description

In #28961, an unconstrained alternate key was added to the model purely to make a non-identifying relationship artificially identifying. #30213 attempted to fix this by throwing indicating that the key was being modified. However, this scenario is basically identical to the case for a many-to-many join type, where the composite primary key is also not the end of any relationship, but forces the two many-to-one relationships to be identifying. The only difference is that in one case the principal key is primary and in the other the principal key alternate.

I prepared a PR that would only throw if the key involved is alternate, but on reflection that doesn't seem like an appropriate distinction to make--a many-to-many join table could have an alternate key. At this point, I think the appropriate thing to do is revert the change made in 8 and just accept that the behavior is the way it is for historical reasons, even though we might do something different if we were working on this.

Customer impact

Exception thrown when manipulating many-to-one relationships that are being used to model many-to-many with a join table in cases where it worked before.

How found

Multiple customers reports on 8.0

Regression

Yes

Testing

Testing existed but was changed when we made the behavior change in 8.0. We just didn't recognize the full consquences of the change, which was intended to be a bug fix.

Risk

Low and quirked. It is very unlikely people are relying on the new behavior, which is to throw.

…lternate key property (#32492)

Fixes #28961
Reverts #30213 for #32385

In #32385, an unconstrained alternate key was added to the model purely to make a non-identifying relationship artificially identifying. #30213 attempted to fix this by throwing that the key was being modified. However, this scenario is very similar to the case for a many-to-many join type, where the composite primary key is also not the end of any relationship, but forces the two many-to-one relationships to be identifying.

I prepared a PR that would only throw if the key involved is alternate, but on reflection that doesn't seem like an appropriate distinction to make. So overall, I think we should just revert this change, which is what this PR does.
@ajcvickers ajcvickers added this to the 8.0.x milestone Dec 5, 2023
@ajcvickers ajcvickers requested a review from a team December 5, 2023 18:58
}
else
{
if (foreignKey.IsRequired
Copy link
Member

Choose a reason for hiding this comment

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

merge with else

@AndriySvyryd
Copy link
Member

Note that the branch is currently closed.

@wtgodbe wtgodbe merged commit 0508ce7 into release/8.0 Jan 3, 2024
7 checks passed
@wtgodbe wtgodbe deleted the 231205_IdentifyYourself branch January 3, 2024 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants