Per EDB's Coverity analysis, "runtimeKeyInfo" is only non-NULL if "econtext" is also non-NULL, so we can eliminate a conditional on the former by moving it inside an "if" block for the latter. Per discussion of earlier similar changes, this is not for performance reasons but for code clarity.

Barring any objections I'll apply this tonight or tomorrow.

-Neil
Index: src/backend/executor/nodeIndexscan.c
===================================================================
RCS file: /Users/neilc/local/cvs/pgsql/src/backend/executor/nodeIndexscan.c,v
retrieving revision 1.103
diff -c -r1.103 nodeIndexscan.c
*** src/backend/executor/nodeIndexscan.c	6 May 2005 17:24:54 -0000	1.103
--- src/backend/executor/nodeIndexscan.c	8 Jul 2005 05:06:41 -0000
***************
*** 208,221 ****
  		 * recalculate *all* runtime keys on each call.
  		 */
  		ResetExprContext(econtext);
- 	}
  
! 	/*
! 	 * If we are doing runtime key calculations (ie, the index keys depend
! 	 * on data from an outer scan), compute the new key values
! 	 */
! 	if (runtimeKeyInfo)
! 	{
  		ExecIndexEvalRuntimeKeys(econtext,
  								 runtimeKeyInfo,
  								 scanKeys,
--- 208,219 ----
  		 * recalculate *all* runtime keys on each call.
  		 */
  		ResetExprContext(econtext);
  
! 		/*
! 		 * If we are doing runtime key calculations (ie, the index
! 		 * keys depend on data from an outer scan), compute the new
! 		 * key values
! 		 */
  		ExecIndexEvalRuntimeKeys(econtext,
  								 runtimeKeyInfo,
  								 scanKeys,
***************
*** 603,610 ****
  
  		Assert(leftop != NULL);
  
! 		if (!(IsA(leftop, Var) &&
! 			  var_is_rel((Var *) leftop)))
  			elog(ERROR, "indexqual doesn't have key on left side");
  
  		varattno = ((Var *) leftop)->varattno;
--- 601,607 ----
  
  		Assert(leftop != NULL);
  
! 		if (!(IsA(leftop, Var) && var_is_rel((Var *) leftop)))
  			elog(ERROR, "indexqual doesn't have key on left side");
  
  		varattno = ((Var *) leftop)->varattno;
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to