Repository navigation
fix: ignore temporary aliases in standalone table rename - #31136
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? |
acaa999 to
bd4fa09
Compare
|
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: bd4fa09cfbcb0704bd90359a8b951ed681a56dfd
Assessment: request_changes
Reviewed the complete 17-file delta. The explicit resolver policy appropriately reuses existing ownership and visibility checks, but prepared-statement dependency collection remains inconsistent and causes a reproduced executor panic.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
- P2
pkg/sql/plan/build_ddl.go:6874: Session A creates a temporary table shadowing persisted src and prepares 'RENAME TABLE src TO dst'. Session B drops persisted src and creates a view named src. Session A executes the prepared statement.
Impact: The rename plan targets the persisted table, but collectPrepareDdlSchemas still uses temporary-first Resolve at build_dcl.go:508. Consequently, persisted-source replacement does not invalidate the plan. EXECUTE reaches doLockTable with stale table metadata and returns a recovered 'panic invalid primary keys' instead of rejecting the view normally. Apply the same alias-free resolution policy to standalone RENAME's prepared source/destination dependencies and add a cross-session replacement regression.
Evidence: The diagnostic planner probe records temporary ID 99 while the rename plan targets persisted ID 11. The two-session SQL probe reproduces the recovered panic; fresh RENAME and the unshadowed prepared control return the normal view-rejection error. See planner-probe.log and protocol-probe.log:1195 in the assigned attempt directory.
Validation:
-
Artifacts retained under /home/xupeng/.local/state/mo-bot/jobs/c315505c4a13c3a5e2e843dd/attempt-1. review-evidence.json reconciles commands, source fingerprints, exit receipts, log hashes and test-only overlays; source remained unchanged.
-
Isolation preflight passed. Missing native prerequisites were rebuilt through make cgo using hash-verified frozen inputs; native-build.log and native-inputs.json/native-outputs.json preserve provenance.
-
planner-probe.log, receipt checks/1792961019340603463-6.json: all nine existing rename-planner cases and the unshadowed dependency control passed; the shadowed dependency assertion failed.
-
protocol-probe.log, receipt checks/1792961073120841232-3.json: the real SQL replacement probe reproduced the recovered panic; cluster cleanup completed.
-
git diff --check passed. Evidence audit passed with receipt checks/1792961161279688738-4.json.
Limitations:
-
Frozen CI reports successful UT, SCA and BVT checks; raw CI/author logs were not supplied. Full suites were not rerun locally.
-
The linked issue's full body was unavailable; its behavioral contract was assessed from the frozen PR description.
-
No performance benchmark was run. Source tracing shows constant-cost resolver dispatch, no added catalog I/O or shared state, and removal of the alias lookup from standalone rename resolution.
fcce381 to
d72d617
Compare
|
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: d72d6170d8a1e473369230acdd987c4d28c28e67
Assessment: approve
Reviewed the complete 19-file change and affected consumers. Standalone rename and prepared dependencies consistently use persisted names while preserving temporary-table ownership and ordinary ALTER behavior. Prior review 5645200817 is resolved; no actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
Focused tests passed across four packages: 19 top-level tests, 51 total test/subtest passes, zero failures or skips. Includes public SQL tests for cross-session invalidation and transaction behavior. Evidence: focused-tests.jsonl and checks/1793462260583602280-3.json.
-
Isolation preflight passed; reused native artifacts matched 193 current inputs and seven output hashes.
-
Final audit confirmed the frozen head, unchanged source, complete patch match and assessment of all four discussion entries. Evidence: validation-summary.json and checks/1793462394793566071-4.json.
-
Frozen evidence reports successful UT, static analysis and enabled BVT checks; skipped checks were not counted as passes.
Limitations:
- Full package and BVT suites were not rerun locally; raw CI logs and author-reported older-head runs were not independently verified.
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
What type of PR is this?
Which issue(s) this PR fixes:
What this PR does / why we need it:
RENAME TABLEfailed when a session temporary table shadowed its persisted source, and incorrectly rejected destinations occupied only by a temporary alias.Add an explicit compiler-context operation that skips temporary aliases for both standalone rename lookups while preserving catalog visibility and temporary ownership checks. Temporary-only sources report a missing table; temporary-only destinations remain available. Ordinary SELECT/DML and
ALTER TABLEretain temporary-first behavior. View metadata contexts explicitly reject the DDL-only operation.Original validation (
acaa9997ba, reused for unchanged resolver behavior): focused planner/resolver tests, complete plan/frontend/compile packages, protocol regressions for rows and stable table IDs, prepared statements, failed multi-pair renames and physical temporary-table isolation. The SQL BVT passed twice (53/53 each), with database/table cleanup checked between runs. Native service build, affected-package vet, incremental lint and formatting checks passed on Go1.27.1 darwin/arm64.No wire or catalog format changes. The reporter should verify the issue after merge.
Maintenance validation: rebase onto official main
99bd895c46preserved the original PR patch. CI run 40219577066, attempt 2 passed the required checks atbd4fa09cfb.Prepared rename correction (
fcce381f85dd2c608be8d59f7c949f3330b4201a): capture persisted source and destination dependencies using the same namespace as the rename plan. Cross-session replacement of a shadowed source now triggers normal view rejection; creation of a persisted destination triggers the normal collision error. This addresses the prepared-schema review feedback.New validation on Go1.27.1 darwin/arm64: CGo-wrapper
go test -count=1passed the focusedTestCollectPrepareDdlSchemas.*/TestBuildRenameTable.*tests, the completepkg/sql/planpackage, and the extendedTestRenameTableIgnoresTemporaryAliasesreal-protocol regression. The SQL test checks source/view replacement, destination collision, preserved rows and table identities. Both new regressions failed on the unfixed source as expected. Formatting, four-package affected-closure vet/incremental lint, and the exact-commit Loom artifact check passed. Unchanged resolver/BVT evidence above is reused; no new multi-CN, race or performance claim. New-head CI has not been awaited.Official-main CI refresh (
d72d6170d8a1e473369230acdd987c4d28c28e67, based onae40f12a647880a63466de32a9f507c2c72dca0b): both PR patches remain unchanged ingit range-diff. The previous coverage rerun failed in embedded-cluster admission during upgrade recovery; this update picks up the current main/CI corrections and triggers fresh CI. No additional product change or old-run rerun.New validation at this revision (Go1.27.1 darwin/arm64,
go test -count=1): focused planner/PREPARE tests and the completepkg/sql/planpackage passed; frontend/compile resolver ownership and delegation controls passed;TestRenameTableIgnoresTemporaryAliasesandTestRenameTableImplicitCommitpassed through real SQL. Matching pinned usearch/libmo were built in the task temporary directory because the retained local native installation has the old API; the documented expanded CGo test flags used these staged libraries. Formatting, whitespace and exact-commit artifact checks passed. Historical BVT/red-baseline evidence above is reused; full current CI remains pending.