Skip to content

Use RETURNING/OUTPUT clause for UPDATE/DELETE #27547

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

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 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
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants