@@ -63,7 +63,6 @@ static TupleTableSlot *router_set_slot(PartitionRouterState *state,
6363static TupleTableSlot * router_get_slot (PartitionRouterState * state ,
6464 bool * should_process );
6565
66- static void router_lazy_init_junkfilter (PartitionRouterState * state );
6766static void router_lazy_init_constraint (PartitionRouterState * state );
6867
6968static ItemPointerData router_extract_ctid (PartitionRouterState * state ,
@@ -185,8 +184,9 @@ partition_router_exec(CustomScanState *node)
185184
186185 ItemPointerSetInvalid (& ctid );
187186
188- /* Build new junkfilter lazily */
189- router_lazy_init_junkfilter (state );
187+ /* Build new junkfilter if needed */
188+ if (state -> junkfilter == NULL )
189+ state -> junkfilter = state -> current_rri -> ri_junkFilter ;
190190
191191 /* Build recheck constraint state lazily */
192192 router_lazy_init_constraint (state );
@@ -257,15 +257,14 @@ router_set_slot(PartitionRouterState *state,
257257 MTHackField (mt_state , mt_nplans ) = - mt_state -> mt_whichplan ;
258258 MTHackField (mt_state , operation ) = operation ;
259259
260+ /* HACK: disable AFTER STATEMENT triggers */
261+ MTDisableStmtTriggers (mt_state , state );
262+
260263 if (!TupIsNull (slot ))
261264 {
262265 /* We should've cached junk filter already */
263266 Assert (state -> junkfilter );
264267
265- /* HACK: disable AFTER STATEMENT triggers */
266- MTDisableStmtTriggers (mt_state , state );
267-
268-
269268 /* HACK: conditionally disable junk filter in result relation */
270269 state -> current_rri -> ri_junkFilter = (operation == CMD_UPDATE ) ?
271270 state -> junkfilter :
@@ -276,11 +275,6 @@ router_set_slot(PartitionRouterState *state,
276275 slot -> tts_tupleDescriptor );
277276 ExecCopySlot (state -> yielded_slot , slot );
278277 }
279- else
280- {
281- /* HACK: enable AFTER STATEMENT triggers */
282- MTEnableStmtTriggers (mt_state , state );
283- }
284278
285279 /* Yield */
286280 state -> yielded = true;
@@ -324,13 +318,6 @@ router_get_slot(PartitionRouterState *state,
324318 return slot ;
325319}
326320
327- static void
328- router_lazy_init_junkfilter (PartitionRouterState * state )
329- {
330- if (state -> junkfilter == NULL )
331- state -> junkfilter = state -> current_rri -> ri_junkFilter ;
332- }
333-
334321static void
335322router_lazy_init_constraint (PartitionRouterState * state )
336323{
0 commit comments