Repository navigation
[4.2] fix(plan): preserve DELETE target scope - #31796
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: d53a6ff96ec6c9dfbc19ce5086bc9ce5fe99d365
Assessment: approve
DELETE target resolution and joined-delete cleanup are consistent across both planners. No actionable defects remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
Isolation preflight passed; native prerequisites matched frozen source inputs.
-
12 focused planner tests and 35 subtests passed. Evidence: planner-test.log and checks/1793316756672259710-3.json.
-
Source remained unchanged; diff whitespace check passed.
-
Complete discussion accounting and check reconciliation saved in discussion-assessment.json and validation-report.json.
Limitations:
-
End-to-end SQL and race tests were not rerun locally; author execution claims lack attached logs.
-
Relevant CI jobs remained in progress in the supplied snapshot.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: b027d9fb5e905906b2ea271dd93617e313cbab14
Assessment: approve
Target resolution preserves explicit-alias behavior, and joined deletes retain row-scoped table and index cleanup. No actionable findings.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
12 focused planner tests and 43 subtests passed.
-
Full planner package and go vet passed.
-
All 34 BVT statements passed twice through the public MySQL frontend, with row, error, unique-key and teardown assertions.
-
Formatting, discussion coverage and unchanged-source audits passed; receipts and logs are reconciled in validation-evidence.json.
Limitations:
-
Relevant CI remained pending in the supplied snapshot.
-
Public SQL validation used a diagnostic probe; mo-tester, race and configured linters were not independently rerun.
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 74e5a6108bed6fe5f9c7ea787eca2577f1a6ec4f
Assessment: approve
DELETE target validation correctly separates CTE scope from writable aliases and preserves row-scoped cleanup for joined deletes. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
Full planner package passed: 1,688 top-level tests and 2,919 subtests, including all 46 new subtests.
-
All 38 SQL regression statements passed twice through the MySQL frontend on a three-CN embedded cluster, including rollback, expected errors, unique-index integrity and cleanup.
-
Five successful receipts reconciled with retained logs in validation-evidence.json. Source remains unchanged; all six discussion entries assessed.
Limitations:
-
Three existing unrelated planner subtests were skipped.
-
The public SQL diagnostic did not run mo-tester or assert result metadata. Race tests and configured linters were not rerun locally; relevant CI was pending in the supplied snapshot.
-
The linked issue's later INSERT/UPDATE reports remain outside this DELETE backport.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #31794
What this PR does / why we need it:
Adapt #31795 to 4.2-dev: resolve DELETE targets against their original FROM sources before CTE lookup/database defaulting. Modern and legacy DELETE share the validation; actual CTE/derived targets and mismatched qualified targets return errors before write planning. Generic INSERT/UPDATE behavior is unchanged. Explicit aliases retain their existing qualified-target precedence, including aliases spelled exactly like the base table; qualified implicit names must match their source.
Also use main's unrestricted-delete classification in both planners. The 4.2 legacy path previously treated a one-target join without WHERE/LIMIT as a full-table delete, enabling truncation or full-index cleanup even when the join selects only some rows. Joined/partitioned deletes retain row-based execution; ordinary unrestricted deletes keep their existing optimization.
Validation: full planner UT, affected DELETE tests with race, branch-configured incremental gofmt/vet/molint/golangci-lint, and twice-run mo-tester comparison (34/34 each) with teardown checks. Incremental golangci reports 0 issues; molint still reports three unchanged recovery diagnostics in
expr_opt.go/returning.go, both identical to the base. BVT includes an outgoing-FK target that forces legacy planning and verifies remaining rows plus deleted/surviving unique-key entries. Local toolchain: Go 1.26.4, darwin/arm64. GitHub CI is separate.Preserve the existing missing-FROM diagnostic when a DELETE target is not a writable source. This keeps the pre-existing multi-table DELETE SQL contract while both planner paths validate targets before writes. Regression coverage includes missing and alias-hidden targets, derived sources, and a missing second target with unchanged rows.
Additional CI-fix validation on Go 1.26.4, darwin/arm64: full planner UT passed; affected planner tests passed with
-race -count=1; branch-configured incremental gofmt, vet and golangci-lint passed with 0 new issues. Molint reports the same three unchangedcheckrecoverdiagnostics inexpr_opt.goandreturning.goas the 4.2 base. In a real three-CN local cluster, the previously failingdelete_multiple_table.sqlpassed 113/115 with 2 existing ignored, anddelete_target_scope.sqlpassed 38/38, with teardown checked.The separate CI UT
TestIssue26114LegacyCrossAccountMetadataCountsTowardTargetQuotatimed out while waiting for a TN shard during cluster startup. One local run passed; this does not establish the CI timeout's cause. New CI results are pending.