[release-23.0] planner: substitute merged DML IN/NOT IN subqueries via ListArg placeholder (#19973)#20029
[release-23.0] planner: substitute merged DML IN/NOT IN subqueries via ListArg placeholder (#19973)#20029vitess-bot[bot] wants to merge 2 commits into
Conversation
|
Hello @arthurschreiber, there are conflicts in this backport. Please address them in order to merge this Pull Request. You can execute the snippet below to reset your branch and resolve the conflict manually. Make sure you replace |
Apply the ListArg case to the rewrite block already present in release-23.0 (which is nested inside the originalSubquery match), and add only the two new IN/NOT IN test cases since release-23.0 does not have the 'same subquery as scalar SET and IN SET' anchor test. Signed-off-by: Arthur Schreiber <arthur@planetscale.com>
There was a problem hiding this comment.
Pull request overview
Backports a vtgate planner correctness fix to ensure merged DML IN/NOT IN subqueries in UPDATE ... SET expressions are properly de-placeholdered when those subqueries are merge-compatible with the outer route, avoiding broken emitted SQL that would reference missing bind vars.
Changes:
- Extend
rewriteMergedSubqueryExprto also substitutesqlparser.ListArgplaceholders (used by DMLIN/NOT IN) in addition to*sqlparser.Argument. - Add regression coverage for
UPDATE ... SET col = (1 IN (subquery))andUPDATE ... SET col = (1 NOT IN (subquery))where the subquery merges into the outer route.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| go/vt/vtgate/planbuilder/operators/subquery_planning.go | Adds sqlparser.ListArg handling so merged DML IN/NOT IN subqueries are rewritten back to their original inline subquery AST. |
| go/vt/vtgate/planbuilder/testdata/dml_cases.json | Adds two planner regression cases covering merge-compatible IN and NOT IN subqueries inside UPDATE ... SET. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
This is a backport of #19973