diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c
index e0a8998..c5e97ef 100644
*** a/src/backend/executor/execExprInterp.c
--- b/src/backend/executor/execExprInterp.c
***************
*** 34,43 ****
   *
   * For very simple instructions the overhead of the full interpreter
   * "startup", as minimal as it is, is noticeable.  Therefore
!  * ExecReadyInterpretedExpr will choose to implement simple scalar Var
!  * and Const expressions using special fast-path routines (ExecJust*).
!  * Benchmarking shows anything more complex than those may as well use the
!  * "full interpreter".
   *
   * Complex or uncommon instructions are not implemented in-line in
   * ExecInterpExpr(), rather we call out to a helper function appearing later
--- 34,41 ----
   *
   * For very simple instructions the overhead of the full interpreter
   * "startup", as minimal as it is, is noticeable.  Therefore
!  * ExecReadyInterpretedExpr will choose to implement certain simple
!  * opcode patterns using special fast-path routines (ExecJust*).
   *
   * Complex or uncommon instructions are not implemented in-line in
   * ExecInterpExpr(), rather we call out to a helper function appearing later
*************** static Datum ExecJustConst(ExprState *st
*** 149,154 ****
--- 147,153 ----
  static Datum ExecJustAssignInnerVar(ExprState *state, ExprContext *econtext, bool *isnull);
  static Datum ExecJustAssignOuterVar(ExprState *state, ExprContext *econtext, bool *isnull);
  static Datum ExecJustAssignScanVar(ExprState *state, ExprContext *econtext, bool *isnull);
+ static Datum ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull);
  
  
  /*
*************** ExecReadyInterpretedExpr(ExprState *stat
*** 184,193 ****
  
  	/*
  	 * Select fast-path evalfuncs for very simple expressions.  "Starting up"
! 	 * the full interpreter is a measurable overhead for these.  Plain Vars
! 	 * and Const seem to be the only ones where the intrinsic cost is small
! 	 * enough that the overhead of ExecInterpExpr matters.  For more complex
! 	 * expressions it's cheaper to use ExecInterpExpr always.
  	 */
  	if (state->steps_len == 3)
  	{
--- 183,190 ----
  
  	/*
  	 * Select fast-path evalfuncs for very simple expressions.  "Starting up"
! 	 * the full interpreter is a measurable overhead for these, and these
! 	 * patterns occur often enough to be worth optimizing.
  	 */
  	if (state->steps_len == 3)
  	{
*************** ExecReadyInterpretedExpr(ExprState *stat
*** 230,235 ****
--- 227,239 ----
  			state->evalfunc = ExecJustAssignScanVar;
  			return;
  		}
+ 		else if (step0 == EEOP_CASE_TESTVAL &&
+ 				 step1 == EEOP_FUNCEXPR_STRICT &&
+ 				 state->steps[0].d.casetest.value)
+ 		{
+ 			state->evalfunc = ExecJustApplyFuncToCase;
+ 			return;
+ 		}
  	}
  	else if (state->steps_len == 2 &&
  			 state->steps[0].opcode == EEOP_CONST)
*************** ExecJustAssignScanVar(ExprState *state, 
*** 1811,1816 ****
--- 1815,1857 ----
  	return 0;
  }
  
+ /* Evaluate CASE_TESTVAL and apply a strict function to it */
+ static Datum
+ ExecJustApplyFuncToCase(ExprState *state, ExprContext *econtext, bool *isnull)
+ {
+ 	ExprEvalStep *op = &state->steps[0];
+ 	FunctionCallInfo fcinfo;
+ 	bool	   *argnull;
+ 	int			argno;
+ 	Datum		d;
+ 
+ 	/*
+ 	 * XXX with some redesign of the CaseTestExpr mechanism, maybe we could
+ 	 * get rid of this data shuffling?
+ 	 */
+ 	*op->resvalue = *op->d.casetest.value;
+ 	*op->resnull = *op->d.casetest.isnull;
+ 
+ 	op++;
+ 
+ 	fcinfo = op->d.func.fcinfo_data;
+ 	argnull = fcinfo->argnull;
+ 
+ 	/* strict function, so check for NULL args */
+ 	for (argno = 0; argno < op->d.func.nargs; argno++)
+ 	{
+ 		if (argnull[argno])
+ 		{
+ 			*isnull = true;
+ 			return (Datum) 0;
+ 		}
+ 	}
+ 	fcinfo->isnull = false;
+ 	d = op->d.func.fn_addr(fcinfo);
+ 	*isnull = fcinfo->isnull;
+ 	return d;
+ }
+ 
  
  /*
   * Do one-time initialization of interpretation machinery.
