Skip to content

Commit

Permalink
Investigating #7782 - catch when Postgres planning removes all Citus
Browse files Browse the repository at this point in the history
tables
  • Loading branch information
colm-mchugh committed Feb 20, 2025
1 parent 459c283 commit 278d9f3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 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,25 @@ 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;

Check warning on line 281 in src/backend/distributed/planner/distributed_planner.c

View check run for this annotation

Codecov / codecov/patch

src/backend/distributed/planner/distributed_planner.c#L281

Added line #L281 was not covered by tests

/* range table entries have been reduced by planner, possibly by constant folding. */
needsDistributedPlanning = ListContainsDistributedTableRTE(

Check warning on line 284 in src/backend/distributed/planner/distributed_planner.c

View check run for this annotation

Codecov / codecov/patch

src/backend/distributed/planner/distributed_planner.c#L284

Added line #L284 was not covered by tests
rtesPostPlan,
&
fDistributedTable);

/* if (!needsDistributedPlanning) */
/* elog(INFO, "needsDistributedPlanning flipped from T to F"); */
}
}

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

0 comments on commit 278d9f3

Please sign in to comment.