Index: src/backend/executor/execAmi.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/executor/execAmi.c,v
retrieving revision 1.89
diff -c -r1.89 execAmi.c
*** src/backend/executor/execAmi.c	2 Aug 2006 01:59:45 -0000	1.89
--- src/backend/executor/execAmi.c	15 Feb 2007 02:53:21 -0000
***************
*** 243,248 ****
--- 243,252 ----
  			ExecSortMarkPos((SortState *) node);
  			break;
  
+ 		case T_ResultState:
+ 			ExecResultMarkPos((ResultState *) node);
+ 			break;
+ 
  		default:
  			/* don't make hard error unless caller asks to restore... */
  			elog(DEBUG2, "unrecognized node type: %d", (int) nodeTag(node));
***************
*** 296,301 ****
--- 300,309 ----
  			ExecSortRestrPos((SortState *) node);
  			break;
  
+ 		case T_ResultState:
+ 			ExecResultRestrPos((ResultState *) node);
+ 			break;
+ 
  		default:
  			elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
  			break;
***************
*** 328,333 ****
--- 336,351 ----
  		case T_Sort:
  			return true;
  
+ 		case T_Result:
+ 			/*
+ 			 * T_Result only supports mark/restore if it has a child plan
+ 			 * that does, so we do not have enough information to give a
+ 			 * really correct answer.  However, for current uses it's
+ 			 * enough to always say "false", because this routine is not
+ 			 * asked about gating Result plans, only base-case Results.
+ 			 */
+ 			return false;
+ 
  		default:
  			break;
  	}
Index: src/backend/executor/nodeResult.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v
retrieving revision 1.34.2.2
diff -c -r1.34.2.2 nodeResult.c
*** src/backend/executor/nodeResult.c	2 Feb 2007 00:07:28 -0000	1.34.2.2
--- src/backend/executor/nodeResult.c	15 Feb 2007 02:53:22 -0000
***************
*** 167,172 ****
--- 167,202 ----
  }
  
  /* ----------------------------------------------------------------
+  *		ExecResultMarkPos
+  * ----------------------------------------------------------------
+  */
+ void
+ ExecResultMarkPos(ResultState *node)
+ {
+ 	PlanState  *outerPlan = outerPlanState(node);
+ 
+ 	if (outerPlan != NULL)
+ 		ExecMarkPos(outerPlan);
+ 	else
+ 		elog(DEBUG2, "Result nodes do not support mark/restore");
+ }
+ 
+ /* ----------------------------------------------------------------
+  *		ExecResultRestrPos
+  * ----------------------------------------------------------------
+  */
+ void
+ ExecResultRestrPos(ResultState *node)
+ {
+ 	PlanState  *outerPlan = outerPlanState(node);
+ 
+ 	if (outerPlan != NULL)
+ 		ExecRestrPos(outerPlan);
+ 	else
+ 		elog(ERROR, "Result nodes do not support mark/restore");
+ }
+ 
+ /* ----------------------------------------------------------------
   *		ExecInitResult
   *
   *		Creates the run-time state information for the result node
***************
*** 180,187 ****
  	ResultState *resstate;
  
  	/* check for unsupported flags */
! 	Assert(!(eflags & EXEC_FLAG_MARK));
! 	Assert(!(eflags & EXEC_FLAG_BACKWARD) || outerPlan(node) != NULL);
  
  	/*
  	 * create state structure
--- 210,217 ----
  	ResultState *resstate;
  
  	/* check for unsupported flags */
! 	Assert(!(eflags & (EXEC_FLAG_MARK | EXEC_FLAG_BACKWARD)) ||
! 		   outerPlan(node) != NULL);
  
  	/*
  	 * create state structure
Index: src/include/executor/nodeResult.h
===================================================================
RCS file: /cvsroot/pgsql/src/include/executor/nodeResult.h,v
retrieving revision 1.22
diff -c -r1.22 nodeResult.h
*** src/include/executor/nodeResult.h	5 Mar 2006 15:58:56 -0000	1.22
--- src/include/executor/nodeResult.h	15 Feb 2007 02:53:22 -0000
***************
*** 20,25 ****
--- 20,27 ----
  extern ResultState *ExecInitResult(Result *node, EState *estate, int eflags);
  extern TupleTableSlot *ExecResult(ResultState *node);
  extern void ExecEndResult(ResultState *node);
+ extern void ExecResultMarkPos(ResultState *node);
+ extern void ExecResultRestrPos(ResultState *node);
  extern void ExecReScanResult(ResultState *node, ExprContext *exprCtxt);
  
  #endif   /* NODERESULT_H */
