PG19: migrate get_relation_info_hook to build_simple_rel_hook#8622
PG19: migrate get_relation_info_hook to build_simple_rel_hook#8622ihalatci wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## pg19-columnar-relinfo #8622 +/- ##
=========================================================
- Coverage 88.94% 88.80% -0.15%
=========================================================
Files 288 288
Lines 64403 64406 +3
Branches 8098 8099 +1
=========================================================
- Hits 57282 57193 -89
- Misses 4785 4873 +88
- Partials 2336 2340 +4 🚀 New features to boost your workflow:
|
Cross-version gate results ✅All three majors build clean under full
Regression-neutrality (PG17/PG18): Item 2 is preprocessor-excluded on PG ≤ 18 ( PG19 targeted notes (against the known port-WIP baseline — diffs expected):
Caveat: the pgenv PG19 (19beta1) build is not |
Item 3 — direct crash→fix evidence on a
|
PG19 removed get_relation_info_hook, which Citus used to strip indexes from partitioned-table plans. Restore that behaviour on PG19 via a thin build_simple_rel_hook wrapper (multi_build_simple_rel_hook) that delegates to the existing multi_get_relation_info_hook body, which re-derives the RangeTblEntry from rel->relid. Keep the get_relation_info_hook registration for PG<=18. No-op on PG17/PG18: the PG19 arms are #if-excluded and the pre-PG19 get_relation_info_hook path is unchanged. Part of #8597. Relates to #8608. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: df69870b-9d04-44fd-9d9e-49e135403864
4883b0c to
6117eac
Compare
What
Restores partitioned-index stripping on PostgreSQL 19, which regressed when PG19 removed the
get_relation_info_hookthat Citus relied on. This is a PG19-only planner-hook migration and a no-op on PG ≤ 18.The columnar
scan_analyze_next_tuplesignature item from the original scope was already fixed in the build-foundation PR #8601 and is intentionally not touched here.Why
PG19 dropped
get_relation_info_hookin favour ofbuild_simple_rel_hook. Citus used that hook (multi_get_relation_info_hook) to strip partitioned indexes from partitioned-table plans. PR #8601 disabled it on PG19 with aTODO(PG19 Phase 2)marker, so index-stripping was temporarily absent on PG19, causing a client-backend crash on partitioned-table planning paths inside the regression suite (make check).How
multi_build_simple_rel_hookindistributed_planner.c(prototype indistributed_planner.h) matching thebuild_simple_rel_hooksignature(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *rte). It delegates straight to the existingmulti_get_relation_info_hookbody, which re-derives theRangeTblEntryfromrel->relid— so the removedrelationObjectId/inhparentarguments are passed asInvalidOid/falseand intentionally ignored, keeping behaviour identical across versions.build_simple_rel_hookunder#if PG_VERSION_NUM >= PG_VERSION_19inshared_library_init.c; the oldget_relation_info_hookassignment is kept under the#elsearm for PG ≤ 18.Files
src/backend/distributed/planner/distributed_planner.csrc/include/distributed/distributed_planner.hsrc/backend/distributed/shared_library_init.cItem 1 (
src/backend/columnar/columnar_tableam.c) is untouched — already fixed in #8601.Scope note
An earlier revision of this PR also carried a
distribution_column.cAccessShareLockchange ("item 3"). That fix addresses a PG16+relation_open()assertion / relcache-lifetime issue that is not PG19-specific, so it has been split out into a separate PR targetingmain. This PR is now scoped solely to the PG19build_simple_rel_hookmigration.Stacking
Stacked on #8619 — base branch is
pg19-columnar-relinfo. GitHub will auto-retarget this PR topg19-supportonce #8619 merges.Cross-version gate
-Werrorbuild green;partitioned_indexes_create(+ setup) regress passed, zero diff — exercises the partitioned-index planning path and proves the hook is active.-Werrorbuild green; same focused regress passed, zero diff — the pre-PG19#elsearm is unchanged and neutral.#if PG_VERSION_NUM >= PG_VERSION_19), so PG17 is structurally unaffected; the earlier full-scope gate confirmed a green PG17-Werrorbuild + regress.citus_indent --checkclean on all touched files.All arms build clean under full
-Werror(no flag demotion). The change is behaviourally confined to PG19; PG ≤ 18 is preprocessor-excluded and proven regression-neutral.Part of #8597. Relates to #8608.