-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Improve pruning to properly support ExecuteUpdate #31407
Labels
area-bulkcud
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
Milestone
Comments
AndriySvyryd
added
consider-for-next-release
and removed
consider-for-current-release
labels
Sep 29, 2023
AndriySvyryd
added
consider-for-current-release
and removed
consider-for-next-release
labels
Oct 18, 2023
roji
added a commit
to roji/efcore
that referenced
this issue
Dec 25, 2023
roji
added a commit
to roji/efcore
that referenced
this issue
Dec 25, 2023
roji
added a commit
to roji/efcore
that referenced
this issue
Dec 25, 2023
Cloess dotnet#31083 Fixes dotnet#31407
roji
added a commit
to roji/efcore
that referenced
this issue
Dec 25, 2023
Closes dotnet#31083 Fixes dotnet#31407
Merged
roji
added
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
and removed
consider-for-current-release
labels
Dec 25, 2023
roji
added a commit
to roji/efcore
that referenced
this issue
Dec 25, 2023
Closes dotnet#31083 Fixes dotnet#31407
roji
added a commit
that referenced
this issue
Dec 29, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area-bulkcud
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
type-bug
#31406, allowed ExecuteUpdate with entity splitting (as long as all updated columns are on the same table). While this works well, if you try to change columns on a non-main (split) table on SQL Server, this fails (see test NonSharedModelBulkUpdatesTestBase.Update_single_table_in_entity_with_entity_splitting); - this does work on SQLite, due to a different query shape.
The root cause here is that we generate an INNER JOIN between the main table and the split table, where the split table is the one being updated. When we prune the expression after translation (SelectExpressionPruningExpressionVisitor), we don't find any reference to the joined table within the SelectExpression: the only references are from the UpdateExpression's column setters, but the pruning visitor doesn't see them.
The proper fix here would be to make pruning a proper visitor, with specific handling for ExecuteUpdate. More generally, we should consider not having UpdateExpression be a wrapper around SelectExpression, but its own expression type that directly contains its elements. This may involve significant work as all postprocessing visitors would need to handle it properly, but it's the more correct representation and would prevent bugs like this from the get-go.
See also:
The text was updated successfully, but these errors were encountered: