Skip to content

Reject FOR PORTION OF distributed modifications - #8763

Draft
ibrahim halatci (ihalatci) wants to merge 1 commit into
mainfrom
ihalatci-reject-for-portion-of
Draft

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

Conversation

@ihalatci

@ihalatci ibrahim halatci (ihalatci) commented Aug 12, 2026

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 PG19beta3 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

@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 (ca8e66a) to head (98bb489).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8763      +/-   ##
==========================================
+ Coverage   88.72%   88.74%   +0.01%     
==========================================
  Files         289      289              
  Lines       65073    65075       +2     
  Branches     8203     8203              
==========================================
+ Hits        57739    57752      +13     
+ Misses       4967     4959       -8     
+ Partials     2367     2364       -3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ihalatci
ibrahim halatci (ihalatci) force-pushed the ihalatci-reject-for-portion-of branch from 9453db3 to dff3bae Compare August 22, 2026 08:17
Base automatically changed from pg19-support to main August 27, 2026 14:02
@ihalatci
ibrahim halatci (ihalatci) marked this pull request as draft August 27, 2026 14:56
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>
@ihalatci
ibrahim halatci (ihalatci) force-pushed the ihalatci-reject-for-portion-of branch from dff3bae to 98bb489 Compare August 28, 2026 12:03
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.

PG19: reject FOR PORTION OF modifications planned by Citus

3 participants