@@ -122,8 +122,8 @@ static void handle_modification_query(Query *parse, transform_query_cxt *context
122122static Plan * partition_filter_visitor (Plan * plan , void * context );
123123static Plan * partition_router_visitor (Plan * plan , void * context );
124124
125- static void state_visit_subplans (List * plans , void (* visitor ) (), void * context );
126- static void state_visit_members (PlanState * * planstates , int nplans , void (* visitor ) (), void * context );
125+ static void state_visit_subplans (List * plans , void (* visitor ) (PlanState * plan , void * context ), void * context );
126+ static void state_visit_members (PlanState * * planstates , int nplans , void (* visitor ) (PlanState * plan , void * context ), void * context );
127127
128128static Oid find_deepest_partition (Oid relid , Index rti , Expr * quals );
129129static Node * eval_extern_params_mutator (Node * node , ParamListInfo params );
@@ -137,13 +137,13 @@ static bool modifytable_contains_fdw(List *rtable, ModifyTable *node);
137137 * id in order to recognize them properly.
138138 */
139139#define QUERY_ID_INITIAL 0
140- static uint32 latest_query_id = QUERY_ID_INITIAL ;
140+ static uint64 latest_query_id = QUERY_ID_INITIAL ;
141141
142142
143143void
144144assign_query_id (Query * query )
145145{
146- uint32 prev_id = latest_query_id ++ ;
146+ uint64 prev_id = latest_query_id ++ ;
147147
148148 if (prev_id > latest_query_id )
149149 elog (WARNING , "assign_query_id(): queryId overflow" );
@@ -187,14 +187,12 @@ plan_tree_visitor(Plan *plan,
187187 plan_tree_visitor ((Plan * ) lfirst (l ), visitor , context );
188188 break ;
189189
190+ #if PG_VERSION_NUM < 140000 /* reworked in commit 86dc90056dfd */
190191 case T_ModifyTable :
191- #if PG_VERSION_NUM >= 140000 /* reworked in commit 86dc90056dfd */
192- plan_tree_visitor (outerPlan (plan ), visitor , context );
193- #else
194192 foreach (l , ((ModifyTable * ) plan )-> plans )
195193 plan_tree_visitor ((Plan * ) lfirst (l ), visitor , context );
196- #endif
197194 break ;
195+ #endif
198196
199197 case T_Append :
200198 foreach (l , ((Append * ) plan )-> appendplans )
@@ -254,15 +252,13 @@ state_tree_visitor(PlanState *state,
254252 state_tree_visitor ((PlanState * ) lfirst (lc ), visitor , context );
255253 break ;
256254
255+ #if PG_VERSION_NUM < 140000 /* reworked in commit 86dc90056dfd */
257256 case T_ModifyTable :
258- #if PG_VERSION_NUM >= 140000 /* reworked in commit 86dc90056dfd */
259- visitor (outerPlanState (state ), context );
260- #else
261257 state_visit_members (((ModifyTableState * ) state )-> mt_plans ,
262258 ((ModifyTableState * ) state )-> mt_nplans ,
263259 visitor , context );
264- #endif
265260 break ;
261+ #endif
266262
267263 case T_Append :
268264 state_visit_members (((AppendState * ) state )-> appendplans ,
@@ -307,15 +303,15 @@ state_tree_visitor(PlanState *state,
307303 */
308304static void
309305state_visit_subplans (List * plans ,
310- void (* visitor ) (),
306+ void (* visitor ) (PlanState * plan , void * context ),
311307 void * context )
312308{
313309 ListCell * lc ;
314310
315311 foreach (lc , plans )
316312 {
317313 SubPlanState * sps = lfirst_node (SubPlanState , lc );
318- visitor (sps -> planstate , context );
314+ state_tree_visitor (sps -> planstate , visitor , context );
319315 }
320316}
321317
@@ -325,12 +321,12 @@ state_visit_subplans(List *plans,
325321 */
326322static void
327323state_visit_members (PlanState * * planstates , int nplans ,
328- void (* visitor ) (), void * context )
324+ void (* visitor ) (PlanState * plan , void * context ), void * context )
329325{
330326 int i ;
331327
332328 for (i = 0 ; i < nplans ; i ++ )
333- visitor (planstates [i ], context );
329+ state_tree_visitor (planstates [i ], visitor , context );
334330}
335331
336332
@@ -939,10 +935,12 @@ partition_router_visitor(Plan *plan, void *context)
939935
940936#if PG_VERSION_NUM >= 140000 /* for changes 86dc90056dfd */
941937 prouter = make_partition_router (subplan ,
942- modify_table -> epqParam );
938+ modify_table -> epqParam ,
939+ modify_table -> nominalRelation );
943940#else
944941 prouter = make_partition_router ((Plan * ) lfirst (lc1 ),
945- modify_table -> epqParam );
942+ modify_table -> epqParam ,
943+ modify_table -> nominalRelation );
946944#endif
947945
948946 pfilter = make_partition_filter ((Plan * ) prouter , relid ,
0 commit comments