@@ -532,6 +532,7 @@ struct expr_walker_context
532
532
{
533
533
const PartRelationInfo * prel ;
534
534
TupleTableSlot * slot ;
535
+ HeapTuple tup ;
535
536
bool clear ;
536
537
};
537
538
@@ -564,7 +565,8 @@ adapt_values (Node *node, struct expr_walker_context *context)
564
565
/* check that type is still same */
565
566
Assert (context -> slot -> tts_tupleDescriptor ->
566
567
attrs [attnum - 1 ]-> atttypid == cst -> consttype );
567
- cst -> constvalue = slot_getattr (context -> slot , attnum , & isNull );
568
+ cst -> constvalue = heap_getattr (context -> tup , attnum ,
569
+ context -> slot -> tts_tupleDescriptor , & isNull );
568
570
cst -> constisnull = isNull ;
569
571
}
570
572
return false;
@@ -633,22 +635,18 @@ partition_filter_exec(CustomScanState *node)
633
635
/* Prepare walker context */
634
636
expr_walker_context .prel = prel ; /* maybe slot will be enough */
635
637
expr_walker_context .slot = slot ;
636
- expr_walker_context .clear = true;
637
-
638
- /* Clear values from slot for expression */
639
- adapt_values ((Node * )prel -> expr , (void * ) & expr_walker_context );
640
-
641
- /* Prepare state before execution */
642
- expr_state = ExecPrepareExpr (prel -> expr , estate );
638
+ expr_walker_context .tup = ExecCopySlotTuple (slot );
639
+ expr_walker_context .clear = false;
643
640
644
641
/* Switch to per-tuple context */
645
642
old_cxt = MemoryContextSwitchTo (GetPerTupleMemoryContext (estate ));
646
643
647
- expr_walker_context .clear = false;
648
-
649
644
/* Fetch values from slot for expression */
650
645
adapt_values ((Node * )prel -> expr , (void * ) & expr_walker_context );
651
646
647
+ /* Prepare state before execution */
648
+ expr_state = ExecPrepareExpr (prel -> expr , estate );
649
+
652
650
/* Execute expression */
653
651
value = ExecEvalExpr (expr_state , econtext , & isnull , & itemIsDone );
654
652
0 commit comments