Repository navigation
fix(plan): return 42S22 for missing columns - #27053
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head d8c1b09.
Blocking: the fix only reclassifies missing columns that reach baseBinder. Other public SQL paths still return ErrorCode 20301 / MySQL 1105 / SQLSTATE HY000 instead of ErrBadFieldError / 1054 / 42S22. Reproduced on this head with:
- SELECT * FROM nation JOIN region USING (missing_col)
- INSERT ... ON DUPLICATE KEY UPDATE n_name = missing_col
- REPLACE ... SET n_name = missing_col
The remaining constructors are in bind_context.go, ondup_update_binder.go, and replace_value_binder.go. Please close the missing-column classification across the public binder paths and add black-box coverage for these cases.
The focused and full pkg/common/moerr, pkg/sql/plan, and pkg/frontend tests, plus build, vet, and diff checks otherwise pass.
aptend
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 93c33b9 completed. The prior blockers are closed: UPDATE assignment targets (unqualified, qualified, and CTE), both LOAD column-list planner paths, and ODKU assignment-target map lookup now consistently produce ErrBadFieldError / MySQL 1054 / SQLSTATE 42S22. I also rechecked the earlier JOIN USING, ODKU expression/VALUES, REPLACE SET, SELECT, and prepared-statement paths and their black-box coverage. The remaining ODKU InvalidInput constructors are for malformed VALUES() syntax/types, not unresolved columns. The Ubuntu UT failure is an unrelated pre-existing publication TestExecuteIteration1 cardinality assertion (expected 2, actual 3) under pkg/vm/engine/test; it does not touch this planner/error-classification diff.
aunjgr
left a comment
There was a problem hiding this comment.
Reviewed exact head 1c8ec9b. Missing-column failures now consistently preserve MatrixOne’s BadField error identity while exposing SQLSTATE 42S22 across SELECT/JOIN, UPDATE, ODKU, REPLACE, LOAD, prepared, and protocol paths. The tests assert the public error contract rather than incidental planner structure.
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head 1c8ec9b0498edf56551d72254599c729ba2b12f1.
Blocking: the missing-column classification still has a public DML bypass in the specialized Iceberg UPDATE planner. buildIcebergUpdateReplacementProjects binds assignment values through NewUpdateBinder, but UpdateBinder.bindColRef still constructs NewInvalidInputf (pkg/sql/plan/update_binder.go:59). On this exact head, a real parser + BuildPlan counterexample using the repository's Iceberg compiler context:
UPDATE gold_orders SET id = missing_col;returns error code 20301 / MySQL 1105 / SQLSTATE HY000 (invalid input: column 'missing_col' does not exist) instead of ErrBadFieldError / 1054 / 42S22. The existing TestMissingColumnUsesMySQLBadFieldDiagnostic only exercises normal catalog-table routes, so all of its cases pass while this specialized route remains inconsistent.
Please classify the unresolved reference in UpdateBinder.bindColRef as a bad-field error and add a black-box Iceberg BuildPlan regression. The same binder is also used by the legacy ODKU builder, so the regression should cover every production caller rather than patching only the Iceberg call site.
The broader audit also found that generated-column/CHECK expressions and FK local/referenced missing columns still produce 1105/HY000. Those DDL forms may require MySQL-specific error codes rather than always 1054, but they should at least use SQLSTATE class 42 per #27024 instead of an internal/generic HY000. Please either close those public missing-reference routes in this PR or explicitly narrow and test the intended contract.
Fresh exact-head checks: the PR's focused missing-column matrix passes; the Iceberg counterexample above reproduces deterministically; git diff --check and the review worktree are clean.
|
已在
Fresh verification: 同时 |
|
针对 review #4950208338,已重新核验当前 exact head
Fresh local evidence on this exact head: CI run |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head dc4c1a856346e0185dc63d8fe1a57c1ebd281659.
The prior blocker is closed: the specialized Iceberg UPDATE binder now classifies unresolved value columns as ErrBadFieldError / MySQL 1054 / SQLSTATE 42S22, with a parser + BuildPlan regression. The same change closes the shared UpdateBinder caller, and the generated-column/CHECK and local/referenced-FK missing-column paths are now covered by the black-box diagnostic matrix.
I also re-audited the remaining "missing column" constructors. The legacy UPDATE fallback first resolves assignment targets through DMLContext before routing, while the IVFFLAT/FULLTEXT INCLUDE sites consume already-validated catalog metadata; neither provides a user-facing counterexample to this contract.
Fresh exact-head verification passed:
- focused missing-column, Iceberg, legacy ODKU, moerr, and MySQL protocol tests under
-race - full
pkg/sql/plansuite git diff --check
No blocking findings.
Merge Queue Status
This pull request spent 1 hour 4 minutes 58 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #27053 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Failing checks:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
What type of PR is this?
Which issue(s) this PR fixes:
issue #27024
What this PR does / why we need it:
fix(plan): return 42S22 for missing columns