From e5bdd8d6f8699dd4efc806ebd68081d60c7e2ea7 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Tue, 17 Dec 2002 15:51:59 +0000
Subject: [PATCH] Skip unnecessary plan-copying now that plan trees are
 read-only in the executor.

---
 src/backend/executor/spi.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index f39c481db93..dba491e3d03 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.81 2002/12/15 21:01:34 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.82 2002/12/17 15:51:59 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -219,9 +219,6 @@ SPI_execp(void *plan, Datum *Values, char *Nulls, int tcount)
 	if (res < 0)
 		return res;
 
-	/* copy plan to current (executor) context */
-	plan = (void *) _SPI_copy_plan(plan, _SPI_CPLAN_CURCXT);
-
 	res = _SPI_execute_plan((_SPI_plan *) plan, Values, Nulls, tcount);
 
 	_SPI_end_call(true);
@@ -1480,7 +1477,7 @@ _SPI_copy_plan(_SPI_plan *plan, int location)
 		parentcxt = _SPI_current->procCxt;
 	else if (location == _SPI_CPLAN_TOPCXT)
 		parentcxt = TopMemoryContext;
-	else
+	else						/* (this case not currently used) */
 		parentcxt = CurrentMemoryContext;
 
 	/*
-- 
GitLab