Repository navigation
[14.0] Update PostgreSQL minors and compatibility handling - #8975
ibrahim halatci (ihalatci) wants to merge 22 commits into
Conversation
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>
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 Report❌ Patch coverage is ❌ Your project check has failed because the head coverage (77.70%) is below the target coverage (87.50%). You can increase the head coverage or adjust the target coverage.
Additional details and impacted files@@ Coverage Diff @@
## release-14.0 #8975 +/- ##
=================================================
- Coverage 88.58% 77.70% -10.88%
=================================================
Files 292 292
Lines 65369 65526 +157
Branches 8237 8262 +25
=================================================
- Hits 57905 50916 -6989
- Misses 5088 11768 +6680
- Partials 2376 2842 +466 🚀 New features to boost your workflow:
|
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>
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>
| { | ||
| free_attrmap(attributeMap); | ||
| return; | ||
| } |
There was a problem hiding this comment.
ConvertRemovedOuterJoinRelation() needs to incorporate fix 7e202b12 from #8973, which removes this early return so system-column and whole-row references are remapped even when there are no dropped columns.
Without it, a previously working query such as:
SELECT count(*)
FROM d l LEFT JOIN d r
ON l.id = r.id AND r.tableoid IS NOT NULL;
fails with something like invalid attnum -6 for rangetable entry r. Please bring over the aforementioned fix and its regression coverage from #8973.
There was a problem hiding this comment.
🟡 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
| 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) | ||
| ); |
| if (list_length(columnNames) == attributeMap->maplen) | ||
| { | ||
| free_attrmap(attributeMap); | ||
| return; | ||
| } |
There was a problem hiding this comment.
Redundant comment - already covered above: #8975 (comment)
Pair with citusdata/the-process#268, merged as d742f20d2d25c3e03c43ab1c685382c77c451a36; stable publication 45002751043. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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 SHAd742f20d2d25c3e03c43ab1c685382c77c451a36. 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
startedwithout 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:
55eb90b68disables propagation before creating the local replay-security schema, matching its local-only teardown.3447df177removes the four auxiliary schemas, sequence/extension and tenant role after all non-superuser metadata assertions, preventing stale ownership and distributed-sequence reuse.47b540b61restores the coordinator metadata entry at the start of foreign-server replay testing, because that fixture requires and later removes it.1e7346233orders five partition membership/bound queries by child name and corrects the introduced expected-header normalization issue.707d96faborders two independently reproduced exclusion-constraint catalog permutations and extends the existing optionalPlanning: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, andSCHEDULE=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 ref70bad9a3c098f605e5f8b25553e5db5334018ff1. No optional dependency upgrade remains in final dependency files; contributor work through65233c58bc8e747e804389d2af747266685e4723is preserved.Historical verified development-image pair, now superseded only by the stable suffix:
-dev-439dbb2, fromcitusdata/the-processcommit439dbb26ce189d64a6a913d7ecee010f2b03fae6, 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:
77ed0e73fbackports main48be61fc2eabb8fe6bd01d5b227ca9fa958902bahere, 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 -j4with configuredCFLAGS=-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:
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.47b540b61, full 44718771946 and PR 44718779246 failed introduced expected-header normalization, subsequently corrected; intermittent partition permutations were fixed without changing rows/bounds. Packaging passed.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.55eb90b68, full 44708345432 and PR 44708324909 passed required CI/coverage; packaging passed;32 advisory repeats exposed the auxiliary-fixture leak subsequently fixed.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.Baseline-proven saved q70: earlier PR43426226146 produced distributed
0 / NULLversus local26 / 18.3333333333333333. Entire untouched release14 source built with-Werroron 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.