Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error: invalid child of chunk append #7514

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .unreleased/pr_7514
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes: #7514 Fix error: invalid child of chunk append
21 changes: 6 additions & 15 deletions src/nodes/chunk_append/planner.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,6 @@
Scan *
ts_chunk_append_get_scan_plan(Plan *plan)
{
if (plan != NULL && (IsA(plan, Sort) || IsA(plan, Result)))
plan = plan->lefttree;

if (plan == NULL)
return NULL;

Expand All @@ -356,7 +353,6 @@
case T_WorkTableScan:
case T_TidRangeScan:
return (Scan *) plan;
break;
case T_CustomScan:
{
CustomScan *custom = castNode(CustomScan, plan);
Expand All @@ -380,26 +376,21 @@
*/
return ts_chunk_append_get_scan_plan(linitial(custom->custom_plans));
}

/*
* This is some other unknown custom scan node, we can't recurse
* into it.
*/
return NULL;
break;

Check warning on line 379 in src/nodes/chunk_append/planner.c

View check run for this annotation

Codecov / codecov/patch

src/nodes/chunk_append/planner.c#L379

Added line #L379 was not covered by tests
}
case T_Sort:
case T_Result:
case T_Agg:
if (plan->lefttree != NULL)
{
Assert(plan->righttree == NULL);
/* Let ts_chunk_append_get_scan_plan handle the subplan */
return ts_chunk_append_get_scan_plan(plan->lefttree);
}
return NULL;
break;
case T_MergeAppend:
return NULL;
default:
elog(ERROR, "invalid child of chunk append: %s", ts_get_node_name((Node *) plan));
break;

Check warning on line 392 in src/nodes/chunk_append/planner.c

View check run for this annotation

Codecov / codecov/patch

src/nodes/chunk_append/planner.c#L392

Added line #L392 was not covered by tests
}
pg_unreachable();

return NULL;

Check warning on line 395 in src/nodes/chunk_append/planner.c

View check run for this annotation

Codecov / codecov/patch

src/nodes/chunk_append/planner.c#L395

Added line #L395 was not covered by tests
}
Loading