Potential fix for issues #7782, #7783

colm_testing/release-13.0
Colm McHugh 2025-01-16 18:17:20 +00:00
parent fa8e867662
commit 56df115668
1 changed files with 16 additions and 0 deletions

View File

@ -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);