Skip to content

Reject FOR PORTION OF distributed modifications - #8763

Open
ibrahim halatci (ihalatci) wants to merge 1 commit into
pg19-supportfrom
ihalatci-reject-for-portion-of
Open

Reject FOR PORTION OF distributed modifications#8763
ibrahim halatci (ihalatci) wants to merge 1 commit into
pg19-supportfrom
ihalatci-reject-for-portion-of

Conversation

@ihalatci

Copy link
Copy Markdown
Contributor

Reject PG19 FOR PORTION OF statements requiring distributed planning

PostgreSQL 19 rewrites temporal UPDATE and DELETE statements into the requested portion plus leftover rows for the unaffected temporal ranges. Citus cannot currently preserve those leftover rows during distributed planning, which could otherwise cause silent data loss.

This change adds a mandatory PG_VERSION_NUM >= PG_VERSION_19 guard at the start of ModifyPartialQuerySupported() and returns ERRCODE_FEATURE_NOT_SUPPORTED before target or routing validation. There is no MERGE guard because the PG19 grammar accepts FOR PORTION OF only for UPDATE and DELETE.

The PG19 regression coverage includes both FROM ... TO ... and (portion) syntax forms. It verifies native PostgreSQL behavior and exact leftover fragments for a pure ordinary local table, while rejecting distributed UPDATE and DELETE with local execution enabled and disabled, a modifying CTE, an ordinary local target reading a distributed source, and a period-as-distribution-column DELETE. Pure-local statements bypass distributed planning and remain supported.

Validation:

  • PG17.10, PG18.4, and PG19beta2 WSL builds with CFLAGS=-Werror
  • PG19 focused pg19, multi_modifications, and citus_local_tables_queries regression tests
  • PG18 unchanged-output and planner regression tests
  • PG17 PG19-gating and relevant planner regression tests
  • make check-style
  • git diff --check

Closes #8761

Citus cannot preserve the leftover rows generated by PostgreSQL 19 temporal UPDATE and DELETE planning. Reject those statements before other distributed target and routing checks while leaving ordinary local execution to PostgreSQL.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.74%. Comparing base (db67cd7) to head (9453db3).

Additional details and impacted files
@@               Coverage Diff                @@
##           pg19-support    #8763      +/-   ##
================================================
- Coverage         88.74%   88.74%   -0.01%     
================================================
  Files               289      289              
  Lines             65065    65067       +2     
  Branches           8200     8201       +1     
================================================
- Hits              57743    57742       -1     
- Misses             4957     4959       +2     
- Partials           2365     2366       +1     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants