@@ -63,7 +63,6 @@ static TupleTableSlot *router_set_slot(PartitionRouterState *state,
63
63
static TupleTableSlot * router_get_slot (PartitionRouterState * state ,
64
64
bool * should_process );
65
65
66
- static void router_lazy_init_junkfilter (PartitionRouterState * state );
67
66
static void router_lazy_init_constraint (PartitionRouterState * state );
68
67
69
68
static ItemPointerData router_extract_ctid (PartitionRouterState * state ,
@@ -185,8 +184,9 @@ partition_router_exec(CustomScanState *node)
185
184
186
185
ItemPointerSetInvalid (& ctid );
187
186
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 ;
190
190
191
191
/* Build recheck constraint state lazily */
192
192
router_lazy_init_constraint (state );
@@ -257,15 +257,14 @@ router_set_slot(PartitionRouterState *state,
257
257
MTHackField (mt_state , mt_nplans ) = - mt_state -> mt_whichplan ;
258
258
MTHackField (mt_state , operation ) = operation ;
259
259
260
+ /* HACK: disable AFTER STATEMENT triggers */
261
+ MTDisableStmtTriggers (mt_state , state );
262
+
260
263
if (!TupIsNull (slot ))
261
264
{
262
265
/* We should've cached junk filter already */
263
266
Assert (state -> junkfilter );
264
267
265
- /* HACK: disable AFTER STATEMENT triggers */
266
- MTDisableStmtTriggers (mt_state , state );
267
-
268
-
269
268
/* HACK: conditionally disable junk filter in result relation */
270
269
state -> current_rri -> ri_junkFilter = (operation == CMD_UPDATE ) ?
271
270
state -> junkfilter :
@@ -276,11 +275,6 @@ router_set_slot(PartitionRouterState *state,
276
275
slot -> tts_tupleDescriptor );
277
276
ExecCopySlot (state -> yielded_slot , slot );
278
277
}
279
- else
280
- {
281
- /* HACK: enable AFTER STATEMENT triggers */
282
- MTEnableStmtTriggers (mt_state , state );
283
- }
284
278
285
279
/* Yield */
286
280
state -> yielded = true;
@@ -324,13 +318,6 @@ router_get_slot(PartitionRouterState *state,
324
318
return slot ;
325
319
}
326
320
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
-
334
321
static void
335
322
router_lazy_init_constraint (PartitionRouterState * state )
336
323
{
0 commit comments