diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index a7dafeb..051e70c 100644
*** a/src/backend/executor/nodeAgg.c
--- b/src/backend/executor/nodeAgg.c
*************** advance_aggregates(AggState *aggstate, A
*** 480,486 ****
  		TupleTableSlot *slot;
  
  		/* Evaluate the current input expressions for this aggregate */
! 		slot = ExecProject(peraggstate->evalproj, NULL);
  
  		if (peraggstate->numSortCols > 0)
  		{
--- 480,489 ----
  		TupleTableSlot *slot;
  
  		/* Evaluate the current input expressions for this aggregate */
! 		if (peraggstate->evalproj)
! 			slot = ExecProject(peraggstate->evalproj, NULL);
! 		else
! 			slot = peraggstate->evalslot;
  
  		if (peraggstate->numSortCols > 0)
  		{
*************** ExecInitAgg(Agg *node, EState *estate, i
*** 1728,1738 ****
  		peraggstate->evalslot = ExecInitExtraTupleSlot(estate);
  		ExecSetSlotDescriptor(peraggstate->evalslot, peraggstate->evaldesc);
  
! 		/* Set up projection info for evaluation */
! 		peraggstate->evalproj = ExecBuildProjectionInfo(aggrefstate->args,
! 														aggstate->tmpcontext,
! 														peraggstate->evalslot,
! 														NULL);
  
  		/*
  		 * If we're doing either DISTINCT or ORDER BY, then we have a list of
--- 1731,1744 ----
  		peraggstate->evalslot = ExecInitExtraTupleSlot(estate);
  		ExecSetSlotDescriptor(peraggstate->evalslot, peraggstate->evaldesc);
  
! 		/* Set up projection info for evaluation, if agg has any args */
! 		if (aggrefstate->args)
! 			peraggstate->evalproj = ExecBuildProjectionInfo(aggrefstate->args,
! 															aggstate->tmpcontext,
! 															peraggstate->evalslot,
! 															NULL);
! 		else
! 			peraggstate->evalproj = NULL;
  
  		/*
  		 * If we're doing either DISTINCT or ORDER BY, then we have a list of
