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

Use RETURNING/OUTPUT clause for UPDATE/DELETE #27547

Closed
Tracked by #26797 ...
roji opened this issue Mar 2, 2022 · 0 comments · Fixed by #27663
Closed
Tracked by #26797 ...

Use RETURNING/OUTPUT clause for UPDATE/DELETE #27547

roji opened this issue Mar 2, 2022 · 0 comments · Fixed by #27663
Assignees
Labels
area-perf area-save-changes closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@roji
Copy link
Member

roji commented Mar 2, 2022

When modifying a row that has database-generated values, we currently use UPDATE+SELECT:

UPDATE [WithSomeDatabaseGenerated] SET [Data2] = @p0
WHERE [Id] = @p1;

SELECT [Data1]
FROM [WithSomeDatabaseGenerated]
WHERE @@ROWCOUNT = 1 AND [Id] = @p1;

We could use the RETURNING clause (SQL Server OUTPUT) to reduce this to one statement, like we're doing for INSERT in #27372. This would also allow removing the transaction.

For SQL Server with triggers, we would keep the above.

@roji roji self-assigned this Mar 2, 2022
@ajcvickers ajcvickers added this to the 7.0.0 milestone Mar 4, 2022
@roji roji changed the title Use RETURNING/OUTPUT clause for UPDATE Use RETURNING/OUTPUT clause for UPDATE/DELETE Mar 5, 2022
roji added a commit to roji/efcore that referenced this issue Mar 17, 2022
@roji roji added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Mar 17, 2022
roji added a commit to roji/efcore that referenced this issue Mar 17, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0, 7.0.0-preview3 Mar 31, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.0-preview3, 7.0.0 Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-perf area-save-changes closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants