diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 4ea0cbadadbc14614d5e8182ec1da0ded631ee0f..c86a8456424df20e304f55c6de2628fa4f89db1f 100644
*** a/src/backend/executor/execQual.c
--- b/src/backend/executor/execQual.c
*************** restart:
*** 1801,1812 ****
  				pgstat_end_function_usage(&fcusage,
  										rsinfo.isDone != ExprMultipleResult);
  			}
! 			else
  			{
  				result = (Datum) 0;
  				*isNull = true;
  				*isDone = ExprEndResult;
  			}
  
  			/* Which protocol does function want to use? */
  			if (rsinfo.returnMode == SFRM_ValuePerCall)
--- 1801,1820 ----
  				pgstat_end_function_usage(&fcusage,
  										rsinfo.isDone != ExprMultipleResult);
  			}
! 			else if (fcache->func.fn_retset)
  			{
+ 				/* for a strict SRF, result is an empty set */
  				result = (Datum) 0;
  				*isNull = true;
  				*isDone = ExprEndResult;
  			}
+ 			else
+ 			{
+ 				/* for a strict non-SRF, result is a NULL */
+ 				result = (Datum) 0;
+ 				*isNull = true;
+ 				*isDone = ExprSingleResult;
+ 			}
  
  			/* Which protocol does function want to use? */
  			if (rsinfo.returnMode == SFRM_ValuePerCall)
