Skip to content

[14.0] Update PostgreSQL minors and compatibility handling - #8975

Merged
ibrahim halatci (ihalatci) merged 27 commits into
release-14.0from
ihalatci-citus-14-pg-update
Nov 26, 2026
Merged

ibrahim halatci (ihalatci) merged 27 commits into
release-14.0from
ihalatci-citus-14-pg-update

Conversation

@ihalatci

@ihalatci ibrahim halatci (ihalatci) commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

DESCRIPTION: Update PostgreSQL 16/17/18 and related compatibility handling.

Current stable-image head d9a556c1ff9e6f7fefdf1e555a58671c9345189c: suffix-only promotion to -vd742f20. Paired with merged citusdata/the-process#268, exact merge/image SHA d742f20d2d25c3e03c43ab1c685382c77c451a36. Stable publication 45002751043 succeeded: all release jobs passed, dev jobs skipped; the image owner independently verified all 14 exact-merge manifests and matching push digests. All four per-PG families for 16.16/17.12/18.7, pgupgradetester 16.16-17.12-18.7, and stylechecker 0.8.33 use this suffix. The image source comparison from the previously validated development revision has no file changes; baseline dependencies are retained. Actual PG/server/libpq versions remain matched, including PG18 package revision 18.7-1.pgdg12+5 (upstream 18.7 unchanged).

Full stable-image Build & Test 45003337608 was dispatched with skip_test_flakyness=false. New-head results are pending, not inherited from the previous head. Only the workflow suffix was committed/pushed; no dependency or planner changes were published, and this PR has not been merged.

q13/q70 disclosure: both saved complete fixtures remain unfixed in the published source. The independently proven query-local relation-index collision is tracked by #8838; the existing correction is #8842. Its local-only release14 adaptation passed strict builds, focused 8-test schedules and both original complete 250-query distributed/local workloads on PG16.16/17.12/18.7, including a PG18 negative control. That three-file correction is deliberately uncommitted/unpublished pending separate authorization. These references do not close the main issue. Stable-image promotion and randomized green runs do not establish that the published source fixes these workloads.

Historical development-image validation below refers to 707d96fab6bf7b687b455e963377b3d108e94b72, not the new stable-image gate. Required CI and style passed in both full dispatch 44731403982 and PR Build & Test 44731409394. All 32 flakiness jobs passed in each run: 64 actual advisory executions, no skips. Packaging 44731409419 passed all 23 jobs. Actual Codecov checks passed: project 88.26% against unchanged 87.50%, patch 97.59% against 75%.

Overall historical workflows were still failure, not green. The PR run retained 12 frozen-14.2 PG18 Lib/Coordinator N-1 failures. The dispatch additionally had a SQL N-1 PG18 check-split job whose exact step metadata reported Run Test success, failure in save_logs_and_results; its logs returned HTTP404/stream errors and no matching SQL-N-1 artifact was published, so no SQL regression or baseline attribution is claimed for that artifact-publication failure. These groups remain disclosed and unsuppressed.

Coverage report recovery at the historical head: initial project 86.44% had 149 accepted uploads stuck started without totals, including all six create-Citus reports from both runs; 152 reports were merged. A single bounded successful PG18 create-Citus suite rerun at unchanged head uploaded a genuine 5,516,306-byte report with HTTP200, restoring 1,197 covered lines (56,646 to 57,843 of 65,530). The actual GitHub project check then passed at 88.26%. The PR workflow's attempt2 still retained historical N-1 failures. No source, threshold, ignores, dependency or result filtering changed for coverage recovery, and no failing tests were blanket-rerun away.

Surgical test-flakiness corrections: 55eb90b68 disables propagation before creating the local replay-security schema, matching its local-only teardown. 3447df177 removes the four auxiliary schemas, sequence/extension and tenant role after all non-superuser metadata assertions, preventing stale ownership and distributed-sequence reuse. 47b540b61 restores the coordinator metadata entry at the start of foreign-server replay testing, because that fixture requires and later removes it. 1e7346233 orders five partition membership/bound queries by child name and corrects the introduced expected-header normalization issue. 707d96fab orders two independently reproduced exclusion-constraint catalog permutations and extends the existing optional Planning: label filter to nested worker indentation; all memory, timing and plan content remains asserted. Three corresponding expected label lines/row counts were updated. No security/result assertions were weakened, errors blessed, tests skipped, product behavior changed or dependencies upgraded.

Focused validation on actual PG16.16/17.12/18.7: make -C src/test/regress check-custom-schedule SCHEDULE=metadata_repeat_schedule WORKERCOUNT=2, SCHEDULE=object_metadata_repeat_schedule, and SCHEDULE=foreign_server_repeat_schedule — each passed all 13 tests on each major (three prerequisites plus ten fixture repetitions). make -C src/test/regress check-custom-schedule SCHEDULE=pg17_repeat_schedule WORKERCOUNT=2 — final 15 tests passed on every major, including ten full PG17 fixtures and a controlled assertion that both indented/unindented optional labels are removed while scan/timing lines survive. Original fixture failures were reproduced before correction; subsequent CI independently passed their eight repetitions. The temporary PG17 schedule initially omitted its documented behavioral-analytics prerequisite; adding that prerequisite fixed only the validation harness. Actual full style and expected-output normalization checks passed at the historical head.

Updates supported PostgreSQL versions to 16.16, 17.12, and 18.7, including PG18 SQL snapshots, upgrade-image combinations and development-container PostgreSQL pins. Support categories remain unchanged.

Dependency upgrades are main-only. Both regression Pipfile/lockfile pairs and development-container formatter requirements match untouched release14 baseline cefd6ce76bfbcfa76581b8fa274ec9c5f8766941, including mitmproxy ref 70bad9a3c098f605e5f8b25553e5db5334018ff1. No optional dependency upgrade remains in final dependency files; contributor work through 65233c58bc8e747e804389d2af747266685e4723 is preserved.

Historical verified development-image pair, now superseded only by the stable suffix: -dev-439dbb2, from citusdata/the-process commit 439dbb26ce189d64a6a913d7ecee010f2b03fae6, successful exact-SHA publication 44079514035. The image owner verified all 14 manifests/digests and four baseline dependency exports, including Black 26.3.1/original fork. PostgreSQL/per-major matched libpq remain updated. Earlier dependency-upgrade images are superseded.

Focused normalization backport: 77ed0e73f backports main 48be61fc2eabb8fe6bd01d5b227ca9fa958902ba here, not in the competing PR. Normalization runs after initial PostgreSQL planning and subquery/CTE replanning, not the fast path, with identities assigned first. Modifying CTEs/surviving distributed relations no longer exclude it. Empty-subquery replacements clear inheritance and repair dropped-column numbering, aliases, parent join mappings, whole-row/correlated references and multiple replacements. Existing remote-only coverage, earlier bitmapset/nulling-identity compatibility, coordinator-only fixtures and contributor fixes remain intact.

Normalization validation: make -j4 with configured CFLAGS=-Werror — passed on PG16.16/17.12/18.7. make -C src/test/regress check-custom-schedule SCHEDULE=bitmap_compat_schedule WORKERCOUNT=2 — all 16 tests passed each major, including CTE side effects (99 remaining), surviving distributed subquery, dropped aliases, whole-row/correlated references and remote-only LEFT/RIGHT counts101. Exact uncrustify0.82.0/stylechecker0.8.33 checks and full-CI style passed. An initial temporary-schedule missing-table failure was corrected by loading prerequisites.

Honest prior CI history:

  • At 1e7346233, full 44725641422 and PR 44725649245 passed required CI/style; coverage passed 88.28%/97.59%. Dispatch exposed the indented optional planning label now corrected; remaining jobs were naturally cancelled by the newer head, not counted as passes. Packaging passed.
  • At 47b540b61, full 44718771946 and PR 44718779246 failed introduced expected-header normalization, subsequently corrected; intermittent partition permutations were fixed without changing rows/bounds. Packaging passed.
  • At 3447df177, dispatch 44713089243 passed required CI; PR 44713096152 failed on a PG17 query-generator 20-minute timeout (not a reported wrong result) and PG18 SQL-N-1 TOAST frozen-XID advancement assertion. Both retained32 coordinator-prerequisite repeat failures subsequently fixed. Packaging and coverage88.49%/97.59% passed. No baseline attribution is claimed for the timeout/TOAST failures.
  • At 55eb90b68, full 44708345432 and PR 44708324909 passed required CI/coverage; packaging passed;32 advisory repeats exposed the auxiliary-fixture leak subsequently fixed.
  • At 77ed0e73f, full 44577717940 and PR 44577726289 passed required CI/packaging but retained44 advisory failures also present on untouched baseline42777074395. An earlier missing-create-Citus report recovery restored actual project coverage from86.62% to88.39%, thresholds unchanged.
  • Earlier dispatch44080929861 failed chosen move-shard IDs and unordered partition rows while its paired PR passed. Old failures were not filtered or blanket-rerun.

Baseline-proven saved q70: earlier PR43426226146 produced distributed 0 / NULL versus local 26 / 18.3333333333333333. Entire untouched release14 source built with -Werror on previous PG17.11 and PG17.12 reproduces the identical sole mismatch in exact saved artifact14038580795. It predates this source and minor update. Subsequent root investigation established the shared q13/q70 collision noted above; the validated local correction has not been published. No expected errors were masked.

Only stable-image suffix publication is included in the latest commit. No merge or planner-fix publication is included.

Test PostgreSQL 16.16, 17.12 and 18.7 with the-process 0d5253f dev images. Keep the existing supported majors and align devcontainer pins.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the-process e2d5dee images with libpq matching each PostgreSQL major instead of prerelease libpq19.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Update pyasn1, filelock, certifi, Werkzeug and Black while retaining all unrelated package versions and the existing mitmproxy source.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adapt the shared bitmapset compatibility fix to release14 list iteration while preserving PG17 MERGE handling.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the verified metadata-only mitmproxy prerequisite and resolve the four remaining targets without upgrading unrelated packages or changing Python runtime.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Preserve older-minor alternatives for row-type dependency rejection and schema rename locking.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port shared 75814af and nested-nullability correction 005b02a while preserving release14 PG18 self-join handling. Keep RTE identity and dropped attribute positions, and retain old-minor debug output as an alternative.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Pair the-process bf6c2aec1e5c998c90e1f4ec812ed46118082756 with source dependency inputs d4f1fd2. Exact-SHA publication 43413221363 verified all14 manifests.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Do not replace an original nullable relation merely because a planned subquery no longer appears in the transformed query. Preserve conversion of all matching transformed copies and add a deterministic wrong-result regression.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep fixture DDL and data in the coordinator create schedule, leaving the result assertion in the regular-user and MX query schedule. Avoid the unnecessary superuser-only sorted-merge setting and retain fixtures for repeated query runs.

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

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.64706% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.43%. Comparing base (cefd6ce) to head (631738f).

Additional details and impacted files
@@               Coverage Diff                @@
##           release-14.0    #8975      +/-   ##
================================================
- Coverage         88.58%   88.43%   -0.15%     
================================================
  Files               292      292              
  Lines             65369    65587     +218     
  Branches           8237     8264      +27     
================================================
+ Hits              57905    58000      +95     
- Misses             5088     5217     +129     
+ Partials           2376     2370       -6     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

function_propagation: PostgreSQL 16.16/17.12/18.7 (CVE-2026-6460) reject
ALTER TABLE table_1_for_circ_dep ADD COLUMN ... because the default of
table_2_for_circ_dep uses table_1_for_circ_dep's row type, so PostgreSQL
errors before Citus detects the cycle. Create the column up front and set
its default with ALTER COLUMN ... SET DEFAULT instead. That creates the
same function/table cycle without changing the row type, so Citus raises
its circular-dependency error on old and new minors alike.

isolation_citus_schema_distribute_undistribute: PostgreSQL 16.16/17.12/18.7
(CVE-2026-6467) lock the schema during ALTER SCHEMA ... RENAME, so the
rename waits for s1 on new minors but not on old ones. Make s1 lock the
schema's pg_namespace row before s2 renames it, so the rename waits for
s1 on every minor.

local_dist_join_mixed: new minors remove the nullable "distributed" side of
local LEFT JOIN distributed before Citus wraps "local", which changes the
DEBUG output for that query. Only check its count.

Remove function_propagation_0.out,
isolation_citus_schema_distribute_undistribute_0.out and
local_dist_join_mixed_0.out.
Adding nulling relids to the shard-hiding and Citus-object-hiding filters
moved them above the outer join. As a result, a LEFT JOIN row that matched
only a hidden row was removed instead of being null-extended.

When the meta table is on the nullable side of an outer join, add the
filter to the relation's security quals so it runs while scanning the
relation. Elsewhere keep the old WHERE clause filter.
The query returns true whether or not the planner removes the outer join, and also returns true when the filter is placed above the join, so it does not test what its comment claims.
Dependency upgrades are main-only. Restore the release dependency manifests, lockfiles and development formatter pin without changing PostgreSQL versions or compatibility fixes.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@ihalatci ibrahim halatci (ihalatci) changed the title [14.0] Update PostgreSQL minors and test dependencies [14.0] Update PostgreSQL minors and compatibility handling Nov 17, 2026
Pair the restored release-14 dependency inputs with verified the-process 439dbb26ce189d64a6a913d7ecee010f2b03fae6 images, retaining PostgreSQL 16.16/17.12/18.7 and matched libpq.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Backport main 48be61f for PostgreSQL 16/17/18. Normalize after initial planning and recursive replanning, preserve modifying CTE effects and surviving distributed relations, clear replacement inheritance, and remap dropped-column aliases and references. Preserve existing local-execution-disabled coverage and add the directly related upstream regressions.

Co-authored-by: Colm McHugh <colm.mchugh@gmail.com>

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Disable DDL propagation before creating the local replay-expression schema, matching its teardown and avoiding leftover worker schemas on repeated executions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Drop the auxiliary schemas and tenant role after their metadata and ownership assertions, so repeated runs do not reuse distributed sequences or stale ownership.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Make each fixture invocation establish the coordinator entry it requires and removes, preserving the foreign table owner replay assertions on repeated runs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Order all five partition membership and bound assertions by child name, and normalize the newly added foreign-server setup result separator to the existing test format.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Apply the existing Planning label filter to nested worker plans as well, retaining memory and timing fields. Order the two exclusion-constraint assertions whose catalog scan order varied during repeated validation.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The planner misses required normalization for null-rejected FULL joins and skips whole-row/system-column remapping on tables without dropped columns, allowing valid queries to fail during deparsing.

2 open issues
What changed in this PR

Updates Citus 14.0 for PostgreSQL 16.16, 17.12, and 18.7, with planner compatibility fixes and more repeatable regression tests. Support categories and dependency baselines remain unchanged.

Changes:

  • Updates PostgreSQL pins in CI and development containers.
  • Normalizes removed outer joins and preserves outer-join behavior when hiding catalog objects.
  • Expands compatibility coverage and stabilizes test setup, cleanup, ordering, and expected output.
File Description
src/​test/​regress/​sql/​propagate_foreign_servers.sql Restores coordinator metadata before testing.
src/​test/​regress/​sql/​pg17.sql Orders partition and constraint queries deterministically.
src/​test/​regress/​sql/​non_super_user_object_metadata.sql Cleans up auxiliary schemas and role.
src/​test/​regress/​sql/​multi_test_helpers.sql Filters indented optional planning labels.
src/​test/​regress/​sql/​multi_mx_hide_shard_names.sql Tests shard hiding through outer joins.
src/​test/​regress/​sql/​metadata_replay_security.sql Keeps schema setup local-only.
src/​test/​regress/​sql/​local_dist_join.sql Adds join-normalization and CTE coverage.
src/​test/​regress/​sql/​local_dist_join_mixed.sql Suppresses minor-version-dependent debug output.
src/​test/​regress/​sql/​local_dist_join_load.sql Adds outer-join test data.
src/​test/​regress/​sql/​function_propagation.sql Preserves circular-dependency testing under new PostgreSQL checks.
src/​test/​regress/​sql/​citus_depended_object.sql Tests catalog-object hiding through an outer join.
src/​test/​regress/​sql/​arbitrary_configs_recurring_outer_join.sql Covers dropped columns and reference remapping.
src/​test/​regress/​spec/​isolation_citus_schema_distribute_undistribute.spec Makes schema-rename blocking deterministic.
src/​test/​regress/​expected/​propagate_foreign_servers.out Records coordinator setup output.
src/​test/​regress/​expected/​pg17.out Reflects ordered queries and planning-label filtering.
src/​test/​regress/​expected/​non_super_user_object_metadata.out Records fixture cleanup.
src/​test/​regress/​expected/​multi_test_helpers.out Mirrors the planning-label filter.
src/​test/​regress/​expected/​multi_mx_hide_shard_names.out Records outer-join shard-hiding results.
src/​test/​regress/​expected/​multi_mx_hide_shard_names_0.out Updates alternate shard-hiding expectations.
src/​test/​regress/​expected/​metadata_replay_security.out Mirrors local-only schema setup.
src/​test/​regress/​expected/​local_dist_join.out Records new join and CTE results.
src/​test/​regress/​expected/​local_dist_join_mixed.out Removes version-dependent debug expectations.
src/​test/​regress/​expected/​local_dist_join_load.out Records added fixture data.
src/​test/​regress/​expected/​isolation_citus_schema_distribute_undistribute.out Records explicit locking and rename waits.
src/​test/​regress/​expected/​function_propagation.out Updates circular-dependency expectations.
src/​test/​regress/​expected/​citus_depended_object.out Records null-extended catalog results.
src/​test/​regress/​expected/​arbitrary_configs_recurring_outer_join.out Records column-remapping test results.
src/​include/​distributed/​query_utils.h Exposes outer-join nullability detection.
src/​include/​distributed/​deparse_shard_query.h Exposes empty-subquery conversion.
src/​backend/​distributed/​worker/​worker_shard_visibility.c Filters nullable catalog inputs before joining.
src/​backend/​distributed/​utils/​query_utils.c Detects nullable sides of outer joins.
src/​backend/​distributed/​utils/​citus_depended_object.c Preserves outer rows when hiding catalog objects.
src/​backend/​distributed/​planner/​distributed_planner.c Normalizes removed relations and remaps column references.
src/​backend/​distributed/​planner/​deparse_shard_query.c Shares empty-subquery conversion and clears inheritance.
.github/​workflows/​build_and_test.yml Updates PostgreSQL versions and development-image suffix.
.devcontainer/​Dockerfile Updates PostgreSQL builds and default version.

Review effort: Balanced

Comment on lines +3253 to +3260
rteIndexes = RemovedOuterJoinRelationIndexes(join->larg, query, context,
nullable || join->jointype ==
JOIN_RIGHT);
rteIndexes = bms_join(rteIndexes,
RemovedOuterJoinRelationIndexes(join->rarg, query, context,
nullable ||
join->jointype == JOIN_LEFT)
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Addressed by commit ecec459 in #8973.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving this open: the earlier reply points to a fix in #8973, but that does not change this release14 branch. I tested the three upstream reduced-FULL cases on PG16.16/17.12/18.7 with FULL-side handling unchanged; all returned 101. Bounded controls across auto/prefer-local/prefer-distributed join policies and local execution on/off also passed without the proposed FULL change. I therefore did not include ecec459's runtime or test hunks in the published remapping-only backport. This is not a claim that the concern is fixed or invalid; we still need a discriminating reproducer/configuration where unchanged release14 fails before taking that change.

Auto-resolved by the GitHub Copilot app.

Pair with citusdata/the-process#268, merged as d742f20d2d25c3e03c43ab1c685382c77c451a36; stable publication 45002751043.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Backport main 7e202b1 with its focused regression coverage. Always remap Vars even without dropped-column gaps.

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

@colm-mchugh Colm (colm-mchugh) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The system-column remapping fix and regression coverage address my review concern. Approved.

The PR run still has 12 failing N-1 checks. I independently triaged the Lib N-1 check-multi failure: its five regression diffs are identical to those at the PR base—one quoted-tablespace bug in frozen 14.2.0 and four diagnostic-format mismatches from later fixes. That job is not a regression introduced here.

Please track the required N-1 test adaptations separately. I have not independently established the causes of the other failing N-1 checks.

Put the local/distributed count regression in a self-contained current-only
test, rather than patching the N-1 version (14.2.0) used by N-1 CI. That
predates this PR's eliminated outer join handling.

The moved test expects result `101` on PG18.7. The reduced regress test
`local_dist_join_mixed` passes N-1 testing. The removed query errors out
with Citus 14.2.0 and PG18.7.

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

Copy link
Copy Markdown
Contributor

Please track the required N-1 test adaptations separately. I have not independently established the causes of the other failing N-1 checks.

11 of the 12 N-1 test failures also fail on the release-14 branch; the PG18.7 update in this PR caused local_dist_join_mixed to fail N-1 testing, because 14.2.0 does not have the fix to normalize the outer join elimination in PG18.7. Commit 99e6131 moves the failing test in local_dist_join_mixed out of the way of N-1 testing.

@colm-mchugh Colm (colm-mchugh) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Need to address comments on outer join with view / subquery and the dependency on self-join elimination latently remaining disabled during second planning pass.

Colm (colm-mchugh) and others added 3 commits November 25, 2026 14:44
Follow nullable view and subquery inputs while keeping relation indexes scoped to their owning Query. Retain transformed-relation evidence before replacing a relation and cover flattened views, inline subqueries, nested views and surviving view outputs.

Ref: #8975 (comment)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Muhammad Usama <m.usama@gmail.com>
Guard the second PostgreSQL planning and normalization pass rather than relying on the first pass setting remaining transaction-local. Preserve the existing GUC lifetime. Add materialized-CTE regressions that preserve nullable-side self-join rows and aggregates.

Ref: #8975 (comment)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Muhammad Usama <m.usama@gmail.com>
…joins

PostgreSQL can reduce a FULL join to LEFT or RIGHT and then remove the
unused distributed side. Consider both FULL join inputs when looking for
eliminated relations, and add reduced-FULL regression cases.

(cherry picked from commit e5270cf)
Ref: #8975 (comment)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@colm-mchugh
Colm (colm-mchugh) dismissed their stale review November 25, 2026 16:21

Requested Change addressed in commits 631738f, 0bd8c54, 3c6b8ac

ibrahim halatci (ihalatci) pushed a commit that referenced this pull request Nov 25, 2026
Follow nullable view and subquery inputs while keeping relation indexes scoped to their owning Query. Retain transformed-relation evidence before replacing a relation and cover flattened views, inline subqueries, nested views and surviving view outputs.

Ref: #8975 (comment)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Muhammad Usama <m.usama@gmail.com>
(cherry picked from commit 3c6b8ac)
ibrahim halatci (ihalatci) pushed a commit that referenced this pull request Nov 25, 2026
…joins

PostgreSQL can reduce a FULL join to LEFT or RIGHT and then remove the
unused distributed side. Consider both FULL join inputs when looking for
eliminated relations, and add reduced-FULL regression cases.

(cherry picked from commit e5270cf)
Ref: #8975 (comment)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit 631738f)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ibrahim halatci (ihalatci) added a commit that referenced this pull request Nov 26, 2026
<!-- copilot-assessment:v1 -->
### Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: `96528bb85600c159ab703727fc2e10354d829fa2`

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 9/10 | ↑ Applicable upstream logic retained with
release12 interfaces.<br>↑ Focused tests and all 217 check-multi-1 tests
pass on PG14.25/15.20/16.16; tested source hashes match the final
commit.<br>↓ Broader check-full and N-1 validation were not run. |
| Diagnosis confidence | 9.5/10 | ↑ PG16.16 unpatched view/subquery
queries fail; backport returns the expected counts and preserves
referenced outputs.<br>↑ Query-level diagnostics confirm nullable
context was lost across the original subquery boundary. |
| Evidence fit | 9/10 | ↑ Reproduces the reported
view/flattenable-subquery error on release12.<br>↑ PG16.15 baseline
succeeds, establishing an incomplete minor-upgrade adaptation rather
than a defect introduced by this backport.<br>↓ FULL cases provide
upstream parity coverage, not an independently demonstrated failing
regression. |
<!-- /copilot-assessment -->

DESCRIPTION: Fixes removed outer joins through views and subqueries in
Citus 12.1

Backports Colm McHugh's applicable changes from #8975 onto merged #8974:
- `3c6b8ac7d254e00828ec56d8d88940cbdf5630f9`: follow nullable subqueries
while keeping relation indexes scoped to their owning query.
- `631738fc8843c2451919cef78d930e9f4c8bfeb6`: treat both FULL join
inputs as nullable during normalization.

Preserves transformed-relation evidence and live-identity safeguards.
Upstream regression coverage is placed in the existing
`local_dist_join_mixed` test. The PG18-only SJE change `0bd8c54b` does
not apply to release12's PG14/15/16 support. No version, dependency or
stack changes.

### Local validation

On PostgreSQL **14.25, 15.20 and 16.16**, each command passed:
- `make -j4` and `make install-all`.
- `gosu circleci make -C src/test/regress check-custom-schedule
SCHEDULE=backport-focused.schedule WORKERCOUNT=2`: **6/6**. The local
schedule includes multi_extension, the three test helpers/FDW setup
tests, multi_cluster_management and local_dist_join_mixed.
- `gosu circleci make -C src/test/regress check-multi-1`: **217/217**.

Direct/view/flattenable-subquery probes returned **101** with the
existing dropped-column fixture and **4** with minimal unique-key DDL.
On the unpatched PG16.16 base, view/subquery probes and the new focused
coverage fail with the reported recursive-complex-join error;
direct-table queries already pass. PG14/15 behavior remains unchanged.
Referenced outputs and nonflattenable/duplicate-preservation controls
were retained.

Initial full-suite runs in network-isolated containers failed only on
remove_coordinator's network-error text (plus the expected new
regression failure on the unpatched PG16 base). The same environment
mismatch reproduced on every unpatched base. Seven-test coordinator
controls passed on all six PG/source combinations with normal container
routing, then all three complete patched suites passed without
expectation changes.

Pinned release12 C formatting check passed using `uncrustify -c
/usr/local/etc/citustools/citus-style.cfg --check /source.c` from
stylechecker `0.8.18-vbe937ba`. `git diff --check` passed. No broader
check-full or N-1 run was performed; hosted CI is not yet verified.

Co-authored-by: Colm McHugh <colm.mchugh@gmail.com>
Co-authored-by: Muhammad Usama <m.usama@gmail.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ibrahim halatci (ihalatci) added a commit that referenced this pull request Nov 26, 2026
<!-- copilot-assessment:v1 -->
### Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: `401201bc117ba653d354c29219105357c94fae1d`

| Dimension | Assessment | Rationale |
|---|---|---|
| Change confidence | 7/10 | ↑ Supported PG15.20/16.16/17.12 builds, 132
view/subquery executions and matching local oracles, 30 final focused
tests and 624 check-multi-1 tests pass.<br>↑ Stable image pins and
release dependencies preserved.<br>↓ Full net PR includes earlier
compatibility, CDC and fixture changes beyond the new backport; fresh
hosted upgrade, N-1, advisory and packaging results remain pending.<br>↓
Independent q13/q70 and historical CI blockers remain outside this
correction. |
| Diagnosis confidence | 9/10 | ↑ Unchanged e444 reproduces view
failures on PG16/17 and nested ctid invalid-attnum on PG15; debugger
confirms positive eliminated identity exists but nullable scope is lost
across the original subquery.<br>↑ Colm's query-local backport removes
these failures without changing live projected or duplicate-preserving
results.<br>↓ FULL parity has no discriminating release13 negative
control; it is retained as the requested upstream correction. |
| Evidence fit | 9/10 | ↑ Exact simple/nested view and inline subquery
reproducers match review concerns and become correct on every supported
major.<br>↑ Added PG15 nested ctid regression fails unchanged and passes
the adaptation.<br>↓ This does not explain or repair the separate
q13/q70 wrong-result fixtures. |
<!-- /copilot-assessment -->

DESCRIPTION: Support PostgreSQL 15.20, 16.16 and 17.12 in Citus 13.2

**HOLD: the approved Colm backports are now published; merge and
publication of the separately validated q13/q70 planner correction
remain blocked. This PR still does not contain that correction.**

## Current paired stable images

Current head: `401201bc117ba653d354c29219105357c94fae1d`. Four validated
commits were fast-forwarded onto
`e444cd1090f4a9a8241cf2c32108df4daa594bca`; no force push, merge, image
change or dependency change. The stable suffix remains **`-v7148bd3`**.
Earlier compatibility, CDC and fixture corrections remain intact.

Paired with merged
[citusdata/the-process#271](citusdata/the-process#271),
merge `7148bd3cb9f8b40b168b2021a5cb4c1644b05b61`. Exact-merge [stable
publication45002632140](https://github.com/citusdata/the-process/actions/runs/45002632140)
completed successfully, all13jobs. The image owner independently
verified all13 GHCR manifests: extbuilder/exttester/failtester
for15.20/16.16/17.12, citusupgradetester for15.20/16.16,
pgupgradetester15.20-16.16-17.12, and stylechecker0.8.18. The stable
image source tree is identical to the tested development source8b259ad;
no dependency upgrades or support-category expansion were introduced by
promotion.

Automatically triggered exact-head [Build &
Test45658574479](https://github.com/citusdata/citus/actions/runs/45658574479)
and
[packaging45658574600](https://github.com/citusdata/citus/actions/runs/45658574600)
are **in progress**. No fresh-green or release-readiness claim; no
duplicate dispatch. Earlier suffix-only runs45003262705/45003262762 are
historical and are not evidence for this head.

## Colm backports and validation

Backported [#8975](#8975) commits
`3c6b8ac7d254e00828ec56d8d88940cbdf5630f9` (nullable subquery
normalization), `631738fc8843c2451919cef78d930e9f4c8bfeb6` (both FULL
inputs nullable), and `99e613193640e63aa5ddcbb7915a4c68c1b9e155`
(current-only regression isolation), with cherry-pick provenance.
Preserve release13 candidate identities, values_lists tagging and PG15
dead-relation/system-only remapping rather than converting PG15 join
inputs. The PG18-only SJE commit
`0bd8c54bf38b07a2228cb5d7e4a3ab7a602b8e19` is not applicable: supported
PG15/16/17 runtimes and APIs have no self-join elimination setting. No
dead guards or PG18 tests were copied.

New delta: eight files, 204 insertions/43 deletions. It restores the
self-contained current-only fixture, removes the moved assertion from
shared local_dist_join_mixed, and adds one nested-ctid regression with
runner-generated expected output. The remaining full #8975 net fixes
were compared: relevant catalog filtering, normalization ordering,
remapping and fixture cleanup fixes are already present/equivalent;
release14-only features, dependencies and image pins were not copied.

Supported-major results on PG15.20, PG16.16 and PG17.12, in isolated
retained exact-minor development-image environments:

- `./configure PG_CONFIG=/usr/lib/postgresql/<major>/bin/pg_config
CFLAGS='-O0 -g -Werror' && make -s -j4`: **passed on all three**; `make
-s install-all` and distributed/columnar `install-downgrades`:
**passed**.
- `python3 probe.py <major> <results-directory>`: **44/44 query cases
and 44/44 EXPLAINs passed per major**, matching 22 same-backend local
oracle queries; live view projections, barriers, materialization and
duplicate UNION controls retain their results.
- `make -s -C src/test/regress check-custom-schedule
SCHEDULE=colm13_focused_schedule WORKERCOUNT=2`: **10/10 passed per
major**, including the final added nested-ctid case.
- `make -s -C src/test/regress check-multi-1 WORKERCOUNT=2`: **208/208
passed per major** (624 tests). These runs precede the final test-only
commit, which changes only the current-only fixture excluded from
check-multi-1; C source and full-suite inputs are identical.
- Pinned stylechecker0.8.18 Uncrustify C check, expected-output
normalization and `git diff --check`: **passed**.

Unpatched e444 controls reproduce the nullable view failures on PG16/17
and PG15 nested `ctid` invalid-attnum failure. Patched raw count is5 and
the permanent fixture count is101. New fixture negative controls fail as
expected. Unpatched check-multi-1 passed208/208 on PG15/16; PG17
passed207/208 with an independent insert_select_repartition
intermediate-result file deletion after a parallel transaction
error/savepoint rollback. That failure did not occur in the patched run
and is not claimed fixed by this backport. Reduced-FULL cases already
pass release13 controls; no discriminating FULL negative is claimed.
These local results are not fresh stable-image hosted runtime
validation.

## Scope and changes

- Update supported PostgreSQL minors to15.20/16.16/17.12, corresponding
SQL snapshots and upgrade matrix; preserve historical upgrade Citus
versions and release dependencies.
- Required minor compatibility includes the PG15.20
`have_createdb_privilege` guard and release13 adaptations of planner
normalization/catalog identity handling. Existing focused alias,
dropped-column, whole-row, correlated-reference, CTE-side-effect and
outer-join regressions remain.
- Keep the published fixture repairs: actual follower topology/setup and
fresh clusters per repetition, bounded metadata-daemon startup, complete
statistics sort keys, COPY/ownership cleanup, coordinator registration,
remote-only transaction pool cap, denied-output-plugin allowlist setup,
two constraint sort keys, native metadata-sync prerequisites and nested
EXPLAIN-label filtering. Queries, values, security assertions and repeat
counts were not weakened.
- Regression Pipfiles/locks remain identical to release baseline
`37cd2d55548b84cb25950f82a80cd7a7a370ebaf`; canonical/devcontainer
differences remain. No history rewrite, runtime representative-order
change, new dependency repair or merge.

## Separately gated q13/q70 correction

The pre-existing query-local planner bitmap collision is tracked by
[#8838](#8838), with the proven
correction in [#8842](#8842).
These are non-closing references: this release backport does not close
the main issue. No duplicate issue or PR is needed.

The exact three-file #8842 correction is locally applied and validated
but **uncommitted and unpushed**. The newly published four-commit range
excludes it, and its retained patch hash is unchanged. Both complete
original250-query workloads match their same-backend local oracle on
PG15.20/16.16/17.12: q13=6/0.5; q70=26/18.3333333333333333. Each side
has250markers, each target occurs exactly once and is error-free;
targets are not filtered. Only the repository's two unsupported-query
error classes are excluded symmetrically. Focused existing regressions
passed11/11per major (33total), with strict builds, pinned formatting
and expected-output normalization passing. These results validate local
unpublished code, **not this PR's current pushed head**.

Original immutable artifacts remain14558684680(q13) and14038580795(q70);
later same-name artifact14213888555 is a different workload. Unchanged
release13 on actual PG16.15 and PG16.16 also fails both originals;
current pre-repair PG15.20 fails both. Untouched release14/main
reproduce the defect, so it is not claimed release13-only. The untouched
release13 PG15.20 build conflict is separate compatibility evidence, not
a fabricated baseline oracle.

## Historical CI and remaining blockers

Latest development-image head8b35613da had
[PR44794002638](https://github.com/citusdata/citus/actions/runs/44794002638)
**required CI success**,179successful/10failed/2skipped; [full
dispatch44793994712](https://github.com/citusdata/citus/actions/runs/44793994712)
**required CI failure**,177successful/12failed/2skipped. Both had30/32
advisory jobs pass;
[packaging44794002613](https://github.com/citusdata/citus/actions/runs/44794002613)
passed23/23. These remain historical development-image outcomes, not
results for the current head.

The full dispatch's additional required PG15
`background_rebalance_parallel_reference_tables` failure is proven
representative/debug-order nondeterminism:44dependency rows on each
side, identical numeric dependency edges and logical
colocation/reference-dependency multisets,12representative-label
differences. User explicitly keeps
[#8789](#8789) separate. Its
runtime representative-order policy was not ported and expectations were
not masked.

Reference-DDL errors in issue5248/issue8243 and schema-worker
warning-selection differences remain unclassified.
Historical8Lib/Coordinator N-1 failures remain disclosed. The earlier
six-hour node-health advisory hang did not recur in the latest
development runs, but is not claimed resolved. Fresh randomized green
cannot clear the known original q13/q70 fixtures or these independent
blockers.

Detailed retained CI/fixture chronology and causal controls: [ce607
audit](#8977 (comment)),
[a020
audit](#8977 (comment)),
[8b356
audit](#8977 (comment)),
and [separate8789
disposition](#8977 (comment)).

Historical focused commands: `./configure
PG_CONFIG=/usr/lib/postgresql/<major>/bin/pg_config CFLAGS='-O0 -g
-Werror'` and `make -s -j2 && make -s install` passed all3supported
majors for the normalization backport; `make -s -C src/test/regress
check-custom-schedule SCHEDULE=citus13-validation.schedule
WORKERCOUNT=2` passed8/8per major; `make -s -C src/test/regress
check-arbitrary-configs CONFIGS=AllSingleShardTableDefaultConfig
parallel=1 seed=41255` passed all3majors. These are prior
development-source validation, not a fresh stable-image runtime test.
The suffix-only change passed `git diff --check`; fresh hosted results
for401201bc remain pending.

Siblings: #8973(main), #8975(release14), #8974(release12).

---------

Co-authored-by: Ibrahim Halatci <ihalatci@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Ibrahim Halatci <ihalatci@gmail.com>
Co-authored-by: Colm McHugh <colm.mchugh@gmail.com>
Co-authored-by: emelsimsek <13130350+emelsimsek@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Muhammad Usama <m.usama@gmail.com>
@ihalatci
ibrahim halatci (ihalatci) merged commit bba0169 into release-14.0 Nov 26, 2026
389 of 414 checks passed
@ihalatci
ibrahim halatci (ihalatci) deleted the ihalatci-citus-14-pg-update branch November 26, 2026 08:54
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.

6 participants