Skip to content

[release-23.0] planner: substitute merged DML IN/NOT IN subqueries via ListArg placeholder (#19973)#20029

Open
vitess-bot[bot] wants to merge 2 commits into
release-23.0from
backport-19973-to-release-23.0
Open

[release-23.0] planner: substitute merged DML IN/NOT IN subqueries via ListArg placeholder (#19973)#20029
vitess-bot[bot] wants to merge 2 commits into
release-23.0from
backport-19973-to-release-23.0

Conversation

@vitess-bot
Copy link
Copy Markdown
Contributor

@vitess-bot vitess-bot Bot commented May 5, 2026

Description

This is a backport of #19973

Copilot AI review requested due to automatic review settings May 5, 2026 17:14
@vitess-bot vitess-bot Bot review requested due to automatic review settings May 5, 2026 17:14
@vitess-bot
Copy link
Copy Markdown
Contributor Author

vitess-bot Bot commented May 5, 2026

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 origin by the name of the vitessio/vitess remote

git fetch --all
gh pr checkout 20029
git reset --hard origin/release-23.0
git cherry-pick -m 1 5ea4edd93c7fb4a489382d663304ac3410b8ce3b

@github-actions github-actions Bot added this to the v23.0.4 milestone May 5, 2026
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>
@arthurschreiber arthurschreiber removed Skip CI Skip CI actions from running Merge Conflict labels May 6, 2026
Copilot AI review requested due to automatic review settings May 6, 2026 14:52
@arthurschreiber arthurschreiber marked this pull request as ready for review May 6, 2026 14:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 rewriteMergedSubqueryExpr to also substitute sqlparser.ListArg placeholders (used by DML IN/NOT IN) in addition to *sqlparser.Argument.
  • Add regression coverage for UPDATE ... SET col = (1 IN (subquery)) and UPDATE ... 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.

@arthurschreiber arthurschreiber enabled auto-merge (squash) May 6, 2026 14:56
@mattlord mattlord mentioned this pull request May 7, 2026
34 tasks
@mattlord mattlord modified the milestones: v23.0.4, v23.0.5 May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants