Skip to content

Commit

Permalink
Potential fix for issues #7782, #7783
Browse files Browse the repository at this point in the history
  • Loading branch information
colm-mchugh committed Jan 16, 2025
1 parent fa8e867 commit 56df115
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/backend/distributed/planner/distributed_planner.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,22 @@ distributed_planner(Query *parse,
planContext.plan = standard_planner(planContext.query, NULL,
planContext.cursorOptions,
planContext.boundParams);

if (needsDistributedPlanning)
{
List *rtesPostPlan = ExtractRangeTableEntryList(planContext.query);
if (list_length(rtesPostPlan) < list_length(rangeTableList))
{
bool fDistributedTable = false;

/* range table entries have been reduced by planner, possibly by constant folding. */
needsDistributedPlanning = ListContainsDistributedTableRTE(
rtesPostPlan,
&
fDistributedTable);
}
}

if (needsDistributedPlanning)
{
result = PlanDistributedStmt(&planContext, rteIdCounter);
Expand Down

0 comments on commit 56df115

Please sign in to comment.