Repository navigation
Conversation
DESCRIPTION: Fixes outer join planning on PostgreSQL 16.16, 17.12 and 18.7 PostgreSQL 16.16, 17.12 and 18.7 (commit 9f25197bf27c upstream) remove useless outer joins by editing parse->jointree, which Citus plans after standard_planner(). Distributed relations then disappear from the query that Citus plans, which produces wrong recursive-planning decisions and errors such as "recursive complex joins are only supported when all distributed tables are co-located", or an assertion failure in cassert builds. Port the jointree restore that main already uses for PostgreSQL 19 (#8870) to all supported versions: when standard_planner() leaves fewer relations in the jointree than the original query had, restore the original jointree. There is no compile-time minor version guard, because a package built against an older minor can run on a newer one. On older minors the jointree is never edited, so nothing is restored. The filters that hide shards and Citus-dependent objects from pg_class and the other meta tables are added to the WHERE clause without nullingrels, so on the nullable side of an outer join PostgreSQL evaluates them when scanning the meta table and null-extends the outer row. The new join removal can then remove the meta table while the WHERE clause still references it, which fails an assertion in cassert builds. When the meta table is on the nullable side of an outer join, put the filter into its securityQuals instead: it is still evaluated at scan level, and it is removed together with the relation. Elsewhere, keep adding it to the WHERE clause. Co-authored-by: Ibrahim Halatci <ihalatci@gmail.com> Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
DESCRIPTION: Makes tests stable across PostgreSQL security minor releases PostgreSQL 16.16, 17.12 and 18.7 changed two behaviors that tests relied on: - CVE-2026-6460: ALTER TABLE ADD COLUMN with a default whose type depends on the table's row type is rejected before Citus detects the circular dependency. function_propagation now sets the default on an existing column. - CVE-2026-6467: ALTER SCHEMA RENAME also locks the schema. The isolation test now locks the pg_namespace row explicitly, so the rename waits on every minor version. Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
DESCRIPTION: Bumps CI to PostgreSQL 16.16, 17.12 and 18.7 Points CI at the -dev-bf6c2ae images, which carry the new PostgreSQL minors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-14.0 #8978 +/- ##
================================================
- Coverage 88.58% 88.57% -0.01%
================================================
Files 292 292
Lines 65369 65401 +32
Branches 8237 8241 +4
================================================
+ Hits 57905 57932 +27
- Misses 5088 5093 +5
Partials 2376 2376 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DESCRIPTION: Fixes outer join planning on PostgreSQL 16.16, 17.12 and 18.7
Alternative to #8975 (and #8973 on
main). It uses a different approach to the same breakage.Problem
PostgreSQL 16.16, 17.12 and 18.7 include upstream commit
9f25197bf27c. With it, useless outer joins are removed by editingparse->jointree, which Citus plans afterstandard_planner(). Distributed relations then disappear from the query Citus plans. The result is wrong recursive-planning decisions (recursive complex joins are only supported when all distributed tables are co-located and joined on their distribution columns), or an assertion failure in cassert builds.The same minors also change two behaviors that tests relied on (CVE-2026-6460, CVE-2026-6467).
Approach
distributed_planner.c). Whenstandard_planner()leaves fewer relations in the jointree than the original query had, restore the original jointree.mainalready uses for PG19 (Fix PostgreSQL 19 beta4 compatibility #8870), applied to all supported versions.release-14.0andmaintherefore share one mechanism instead of a new planner heuristic.worker_shard_visibility.c,citus_depended_object.c). Whenpg_classor another meta table is on the nullable side of an outer join, put the hiding filter in the relation'ssecurityQuals. Elsewhere it stays in the WHERE clause.RangeTableEntryIsOnNullableSideOfOuterJoin).function_propagationand isolation spec changes, and the new outer-join and catalog regression cases.local_dist_join_mixedis unchanged: with the restore, its original DEBUG output stays the same on 18.7.-dev-bf6c2aeimages. There are no Python dependency or devcontainer changes.Known limitation, shared with
main's PG19 code: the restore compares top-level relation counts. If subquery pull-up adds a relation while join removal drops one, the counts can match and nothing is restored.Credits: the filter helper and tests are by Onur Tirtir (@onurctirtir) and ibrahim halatci (@ihalatci) (#8975); the restore is from #8870.
Validation
Run locally in WSL against PostgreSQL built from source (
--enable-cassert), with Citus built against each version:make -C src/test/regress check-custom-schedule WORKERCOUNT=2 SCHEDULE=<minimal_schedule + function_propagation, local_dist_join_load, local_dist_join, citus_depended_object>make -C src/test/regress check-custom-schedule WORKERCOUNT=2 SCHEDULE=<minimal_schedule + local_dist_join_mixed>make -C src/test/regress check-custom-schedule WORKERCOUNT=2 SCHEDULE=<multi_mx_schedule through multi_mx_hide_shard_names>make -C src/test/regress check-isolation-custom-schedule WORKERCOUNT=2 SCHEDULE=<base_isolation_schedule + isolation_citus_schema_distribute_undistribute>Additional checks:
make), no C warnings.release-14.0with the new tests on 18.7 failslocal_dist_join,local_dist_join_mixedand the probe with the co-location error above.Not run locally: full regression and isolation suites, PG17 runtime tests, upgrade/N-1 tests, and
check-style(local uncrustify is 0.68, not the pinned 0.82.0). CI covers these.