Repository navigation
Closed
Labels
area/optimizerkind/subtaskseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Description
Parent issue
Problem
The modern binder already handles a joined UPDATE or PostgreSQL-style UPDATE ... FROM when only one target table is assigned. It uses Rowid-based row_number() deduplication to choose one whole source row.
The remaining fallback is specifically len(usedTbl) > 1: one statement assigns columns in more than one physical target table. This task must extend the existing modern invariants per target, not re-migrate single-target UPDATE ... FROM.
Required work
- Represent every updated target as a separate
UpdateCtxunder the modernMULTI_UPDATEplan. - Deduplicate independently by each target's Rowid while preserving one internally consistent source row for all SET expressions.
- Filter outer-join NULL-side rows independently for each updated target.
- Compute generated columns, ON UPDATE expressions, casts/defaults, partition keys, and index keys from each table's final row image.
- Define deterministic lock order and atomic write order across targets.
- Preserve existing single-target joined/
UPDATE ... FROMbehavior and reuse its safeguards where possible. - Integrate with FK and irregular-index work through [Subtask]: Move child-side foreign-key UPDATE validation to MULTI_UPDATE #26338, [Subtask]: Move parent-side FK referential actions to MULTI_UPDATE #26339, and [Subtask]: Move synchronous irregular-index UPDATE maintenance to the modern planner #26341 rather than cloning their logic.
Acceptance criteria
- Statements assigning columns in two or more target tables produce one modern plan with the expected target contexts.
- A physical row is updated at most once per target, even with duplicate source matches.
- Values for multiple SET expressions come from one selected source row, never a per-column mix.
- LEFT/RIGHT join NULL-side rows are filtered by the corresponding target Rowid and are never inserted or updated accidentally.
- Updating only one target in a multi-table source remains on the existing modern path.
- Generated-column chains and ON UPDATE expressions use each target's final row image.
- Base and hidden-index writes are atomic across all updated targets.
- Lock order is deterministic and covered by concurrent conflict/retry tests.
- Affected-row and
IGNOREbehavior match existing compatibility cases. - Existing single-target
UPDATE ... FROMplan tests remain unchanged or are strengthened, not moved to legacy-specific expectations.
Test matrix
- Two/three sources with one updated target (modern control).
- Two/three updated targets.
- INNER, LEFT, and RIGHT joins.
- Multi-target statements with PostgreSQL-style FROM sources where grammar permits.
- Duplicate matches with multiple SET expressions.
- Targets with explicit, composite, and fake PKs.
- Generated/on-update columns, UNIQUE/secondary indexes, and partition columns.
- Partial failure, cancellation, optimistic/pessimistic conflict/retry, and rollback.
- Cross-feature integration cases owned by [Subtask]: Move child-side foreign-key UPDATE validation to MULTI_UPDATE #26338/[Subtask]: Move parent-side FK referential actions to MULTI_UPDATE #26339/[Subtask]: Move synchronous irregular-index UPDATE maintenance to the modern planner #26341.
Dependencies
- Parent: [Task]: Retire the legacy UPDATE planner and converge on MULTI_UPDATE #26336
- Uses [Subtask]: Inventory and instrument legacy UPDATE planner fallbacks #26337 telemetry.
- Coordinates with [Subtask]: Move child-side foreign-key UPDATE validation to MULTI_UPDATE #26338, [Subtask]: Move parent-side FK referential actions to MULTI_UPDATE #26339, and [Subtask]: Move synchronous irregular-index UPDATE maintenance to the modern planner #26341 for cross-feature target contexts.
Metadata
Metadata
Assignees
Labels
area/optimizerkind/subtaskseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Activity