From 1d41e88568782213a52fa88b9f732b730bc29005 Mon Sep 17 00:00:00 2001
From: "Vadim B. Mikheev" <vadim4o@yahoo.com>
Date: Fri, 29 Jan 1999 10:15:09 +0000
Subject: [PATCH] Trying to fix bad merging...

---
 src/backend/executor/execMain.c | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 7623649a4f..ba4d09eaa3 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.66 1999/01/29 09:22:57 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.67 1999/01/29 10:15:09 vadim Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -65,7 +65,7 @@ static TupleDesc InitPlan(CmdType operation, Query *parseTree,
 static void EndPlan(Plan *plan, EState *estate);
 static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
 			CmdType operation, int numberTuples, ScanDirection direction,
-			void (*printfunc) ());
+			DestReceiver *destfunc);
 static void ExecRetrieve(TupleTableSlot *slot, 
 						 DestReceiver *destfunc,
 						 EState *estate);
@@ -756,7 +756,7 @@ ExecutePlan(EState *estate,
 			CmdType operation,
 			int numberTuples,
 			ScanDirection direction,
-			void (*printfunc) ())
+			DestReceiver *destfunc)
 {
 	JunkFilter *junkfilter;
 
@@ -941,7 +941,7 @@ lmark:;
 		{
 			case CMD_SELECT:
 				ExecRetrieve(slot,		/* slot containing tuple */
-							 printfunc, /* print function */
+							 destfunc,	/* print function */
 							 estate);	/* */
 				result = slot;
 				break;
@@ -997,7 +997,7 @@ lmark:;
  */
 static void
 ExecRetrieve(TupleTableSlot *slot,
-			 void (*printfunc) (),
+			 DestReceiver *destfunc,
 			 EState *estate)
 {
 	HeapTuple	tuple;
@@ -1139,8 +1139,7 @@ ExecDelete(TupleTableSlot *slot,
 {
 	RelationInfo	   *resultRelationInfo;
 	Relation			resultRelationDesc;
-	ItemPointerData		ctid,
-						oldtid;
+	ItemPointerData		ctid;
 	int					result;
 
 	/******************
@@ -1180,12 +1179,11 @@ ldelete:;
 				elog(ERROR, "Can't serialize access due to concurrent update");
 			else if (!(ItemPointerEquals(tupleid, &ctid)))
 			{
-				TupleTableSlot *slot = EvalPlanQual(estate, 
+				TupleTableSlot *epqslot = EvalPlanQual(estate, 
 						resultRelationInfo->ri_RangeTableIndex, &ctid);
 
-				if (!TupIsNull(slot))
+				if (!TupIsNull(epqslot))
 				{
-					tupleid = &oldtid;
 					*tupleid = ctid;
 					goto ldelete;
 				}
@@ -1238,8 +1236,7 @@ ExecReplace(TupleTableSlot *slot,
 	HeapTuple			tuple;
 	RelationInfo	   *resultRelationInfo;
 	Relation			resultRelationDesc;
-	ItemPointerData		ctid,
-						oldtid;
+	ItemPointerData		ctid;
 	int					result;
 	int					numIndices;
 
@@ -1321,13 +1318,14 @@ lreplace:;
 				elog(ERROR, "Can't serialize access due to concurrent update");
 			else if (!(ItemPointerEquals(tupleid, &ctid)))
 			{
-				TupleTableSlot *slot = EvalPlanQual(estate, 
+				TupleTableSlot *epqslot = EvalPlanQual(estate, 
 						resultRelationInfo->ri_RangeTableIndex, &ctid);
 
-				if (!TupIsNull(slot))
+				if (!TupIsNull(epqslot))
 				{
-					tupleid = &oldtid;
 					*tupleid = ctid;
+					tuple = ExecRemoveJunk(estate->es_junkFilter, epqslot);
+					slot = ExecStoreTuple(tuple, slot, InvalidBuffer, true);
 					goto lreplace;
 				}
 			}
-- 
2.50.1