diff --git a/src/backend/distributed/planner/multi_router_planner.c b/src/backend/distributed/planner/multi_router_planner.c index 44d83cac8..4424f6e0f 100644 --- a/src/backend/distributed/planner/multi_router_planner.c +++ b/src/backend/distributed/planner/multi_router_planner.c @@ -2225,9 +2225,15 @@ ReorderInsertSelectTargetLists(Query *originalQuery, RangeTblEntry *insertRte, * It is safe to pull Var clause and ignore the coercions since that * are already going to be added on the workers implicitly. */ +#if (PG_VERSION_NUM >= 90600) + targetVarList = pull_var_clause((Node *) oldInsertTargetEntry->expr, + PVC_RECURSE_AGGREGATES); +#else targetVarList = pull_var_clause((Node *) oldInsertTargetEntry->expr, PVC_RECURSE_AGGREGATES, PVC_RECURSE_PLACEHOLDERS); +#endif + targetVarCount = list_length(targetVarList); /* a single INSERT target entry cannot have more than one Var */