From 15dd16785418161def589bbe8e5dd86460214ba4 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sat, 4 Sep 1999 21:45:48 +0000
Subject: [PATCH] Avoid transaction overhead when there are no temp tables to
 be deleted.

---
 src/backend/utils/cache/temprel.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/backend/utils/cache/temprel.c b/src/backend/utils/cache/temprel.c
index 13c78c6934e..75cfe14fbca 100644
--- a/src/backend/utils/cache/temprel.c
+++ b/src/backend/utils/cache/temprel.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.11 1999/09/04 19:55:50 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.12 1999/09/04 21:45:48 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -79,6 +79,9 @@ remove_all_temp_relations(void)
 	List	   *l,
 			   *next;
 
+	if (temp_rels == NIL)
+		return;
+
 	AbortOutOfAnyTransaction();
 	StartTransactionCommand();
 
@@ -102,6 +105,7 @@ remove_all_temp_relations(void)
 
 		l = next;
 	}
+	temp_rels = NIL;
 	CommitTransactionCommand();
 }
 
-- 
GitLab