From 954e466c27ad6e6933b99217749e7cb078243fc1 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Fri, 2 Jul 1999 18:09:28 +0000
Subject: [PATCH] Fix for removal of temp tables if last transaction was
 aborted.

---
 src/backend/postmaster/postmaster.c |  6 +++---
 src/backend/tcop/postgres.c         | 15 ++-------------
 src/backend/utils/cache/temprel.c   |  6 +++++-
 3 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 7a88385e491..14e4235d849 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.106 1999/06/04 21:14:46 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.107 1999/07/02 18:09:27 momjian Exp $
  *
  * NOTES
  *
@@ -1483,8 +1483,8 @@ DoBackend(Port *port)
 	 * Let's clean up ourselves as the postmaster child
 	 */
 
-	on_exit_reset();			/* we don't want the postmaster's
-								 * proc_exit() handlers */
+	/* We don't want the postmaster's proc_exit() handlers */
+	on_exit_reset();	
 
 	/* ----------------
 	 *	register signal handlers.
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index b89cc20af8b..74c407ecd82 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.118 1999/05/29 10:25:30 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.119 1999/07/02 18:09:27 momjian Exp $
  *
  * NOTES
  *	  this is the "main" module of the postgres backend and
@@ -1483,17 +1483,6 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
 		puts("\treset_client_encoding() done.");
 #endif
 
-	/* ----------------
-	 * if stable main memory is assumed (-S(old) flag is set), it is necessary
-	 * to flush all dirty shared buffers before exit
-	 * plai 8/7/90
-	 * this used to be done further down, causing an additional entry in
-	 * the shmem exit list for every error :-( ... tgl 10/1/98
-	 * ----------------
-	 */
-	if (!TransactionFlushEnabled())
-		on_shmem_exit(FlushBufferPool, NULL);
-
 	on_shmem_exit(remove_all_temp_relations, NULL);
 
 	/* ----------------
@@ -1536,7 +1525,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
 	if (!IsUnderPostmaster)
 	{
 		puts("\nPOSTGRES backend interactive interface ");
-		puts("$Revision: 1.118 $ $Date: 1999/05/29 10:25:30 $\n");
+		puts("$Revision: 1.119 $ $Date: 1999/07/02 18:09:27 $\n");
 	}
 
 	/* ----------------
diff --git a/src/backend/utils/cache/temprel.c b/src/backend/utils/cache/temprel.c
index 70d23b6c29c..7a7cb864166 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.4 1999/05/25 22:42:16 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/Attic/temprel.c,v 1.5 1999/07/02 18:09:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,6 +30,7 @@
 #include "nodes/pg_list.h"
 #include "utils/mcxt.h"
 #include "utils/temprel.h"
+#include "access/xact.h"
 #include "access/htup.h"
 #include "access/heapam.h"
 #include "catalog/heap.h"
@@ -79,6 +80,8 @@ remove_all_temp_relations(void)
 	List	   *l,
 			   *next;
 
+	StartTransactionCommand();
+
 	l = temp_rels;
 	while (l != NIL)
 	{
@@ -102,6 +105,7 @@ remove_all_temp_relations(void)
 
 		l = next;
 	}
+	CommitTransactionCommand();
 }
 
 /* we don't have the relname for indexes, so we just pass the oid */
-- 
GitLab