Skip to content

Propagate query tag comment onto bulk DELETE/UPDATE statements - #491

Merged
snaumenko-st merged 1 commit into
master-servicetitanfrom
fix/bulk-delete-update-tag-comment
Jul 16, 2026
Merged

Propagate query tag comment onto bulk DELETE/UPDATE statements#491
snaumenko-st merged 1 commit into
master-servicetitanfrom
fix/bulk-delete-update-tag-comment

Conversation

@snaumenko-st

Copy link
Copy Markdown

Summary

  • Bulk Delete()/DeleteAsync()/Update()/UpdateAsync() (Xtensive.Orm.BulkOperations) built fresh SqlDelete/SqlUpdate DOM nodes that never carried the .Tag(...) SQL comment, because only SqlSelect exposed a Comment property and the comment was never emitted for DELETE/UPDATE statements by the compiler.
  • Moves Comment onto the shared SqlQueryStatement base (covering SqlSelect/SqlDelete/SqlUpdate in one place), propagates it through Clone(), and emits it from VisitDeleteDefault/VisitUpdateDefault in the base SqlCompiler the same way VisitSelectDefault already does.
  • Also fixes the SQL Server v13 compiler's TOP(N) override for Visit(SqlUpdate)/Visit(SqlDelete), which bypasses the shared base-compiler defaults and would otherwise keep dropping the tag on the primary driver.
  • QueryOperation.Join() (shared by BulkDeleteOperation/BulkUpdateOperation) now copies select.Comment onto the target statement.

Test plan

  • Added Extensions/Xtensive.Orm.BulkOperations.Tests/TagTest.cs (TDD: written first, confirmed red against unfixed code) covering Delete(), DeleteAsync(), Update(), UpdateAsync(), and the SQL Server TOP(N)-limited variants of each.
  • dotnet test Extensions/Xtensive.Orm.BulkOperations.Tests — 53 passed, 6 pre-existing provider-specific skips, 0 failed.
  • dotnet test Orm/Xtensive.Orm.Tests --filter FullyQualifiedName~Linq.TagTest — 24 passed (existing SELECT-path tag tests, no regressions).
  • dotnet build Orm.slnx — full solution builds clean.

🤖 Generated with Claude Code

Bulk Delete()/DeleteAsync() and Update()/UpdateAsync() built fresh
SqlDelete/SqlUpdate DOM nodes that never carried the .Tag(...) SQL
comment, since only SqlSelect exposed a Comment property and the
comment was never emitted for DELETE/UPDATE by the compiler. Moves
Comment onto the shared SqlQueryStatement base, emits it from
VisitDeleteDefault/VisitUpdateDefault (and the SQL Server TOP(N)
override, which bypasses the shared defaults), and copies it in
QueryOperation.Join() so both bulk operations pick it up.
@snaumenko-st snaumenko-st self-assigned this Jul 16, 2026
@snaumenko-st
snaumenko-st merged commit 9413b2c into master-servicetitan Jul 16, 2026
34 checks passed
@snaumenko-st
snaumenko-st deleted the fix/bulk-delete-update-tag-comment branch July 16, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants