aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/postgres_fdw.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 5cf10402a20..f15c97ad7a4 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -2370,7 +2370,9 @@ find_modifytable_subplan(PlannerInfo *root,
if (subplan_index < list_length(appendplan->appendplans))
subplan = (Plan *) list_nth(appendplan->appendplans, subplan_index);
}
- else if (IsA(subplan, Result) && IsA(outerPlan(subplan), Append))
+ else if (IsA(subplan, Result) &&
+ outerPlan(subplan) != NULL &&
+ IsA(outerPlan(subplan), Append))
{
Append *appendplan = (Append *) outerPlan(subplan);