Skip to content

Commit 768801c

Browse files
committed
Fix: Preserve relid and cdbpolicy in make_grouping_rel
make_grouping_rel() failed to set the relid and cdbpolicy fields in the grouped_rel it constructs. As a result, extensions using create_upper_paths_hook could see uninitialized values and crash when accessing these fields. The fix is to propagate the values from input_rel, so that grouped_rel carries the same relid and distribution policy as its input. This ensures that hooks and subsequent planner logic can safely rely on them.
1 parent 65cd966 commit 768801c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/backend/optimizer/plan/planner.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4263,6 +4263,8 @@ make_grouping_rel(PlannerInfo *root, RelOptInfo *input_rel,
42634263
grouped_rel->useridiscurrent = input_rel->useridiscurrent;
42644264
grouped_rel->fdwroutine = input_rel->fdwroutine;
42654265
grouped_rel->exec_location = input_rel->exec_location;
4266+
grouped_rel->cdbpolicy = input_rel->cdbpolicy;
4267+
grouped_rel->relid = input_rel->relid;
42664268

42674269
return grouped_rel;
42684270
}

0 commit comments

Comments
 (0)