Skip to content

fix(plan): fallback UPDATE generated-column correctness (follow-up #24536)#24600

Open
ck89119 wants to merge 2 commits into
matrixorigin:mainfrom
ck89119:fix-23137-fallback-gencol
Open

fix(plan): fallback UPDATE generated-column correctness (follow-up #24536)#24600
ck89119 wants to merge 2 commits into
matrixorigin:mainfrom
ck89119:fix-23137-fallback-gencol

Conversation

@ck89119
Copy link
Copy Markdown
Contributor

@ck89119 ck89119 commented May 26, 2026

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #23137

What this PR does / why we need it:

Follow-up correctness fixes for PostgreSQL-style UPDATE ... SET ... FROM ... WHERE fallback planning, completing #24536 (already merged to main).

These two fixes were added during review of the 4.0-dev backport (#24562) but were missing on main:

  • keep fallback update generated columns contiguous (892d892b3): generated-column recompute expressions are inserted into the current target table's contiguous update segment instead of being appended after all targets, so later targets in a multi-target fallback UPDATE no longer read/write wrong projection positions.
  • recompute fallback generated columns after rewrites (988c01bbb): the fallback generated-column recompute now runs after rewriteUpdateQueryLastNode(), so DEFAULT / ON UPDATE rewrites are visible before generated expressions are derived; the generated-column lookup is mutable so generated-on-generated chains use freshly recomputed earlier expressions.

Added planner coverage for the multi-target fallback + generated-column case, and for fallback generated columns over DEFAULT, ON UPDATE, and generated-on-generated chains.

@ck89119 ck89119 requested review from aunjgr and ouyuanning as code owners May 26, 2026 07:00
@qodo-code-review
Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copy link
Copy Markdown

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Contributor

@aunjgr aunjgr left a comment

Choose a reason for hiding this comment

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

No blocking issues found.

The fallback UPDATE planner change keeps generated-column projections contiguous after rewrite and now recomputes them from the rewritten source expressions, so DEFAULT / ON UPDATE / chained generated-column cases stay correct. The new planner tests cover the risky cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants