From a3e2bc732db60dfbea276d93a356fb844b4c0dc3 Mon Sep 17 00:00:00 2001
From: Hiroshi Inoue <inoue@tpf.co.jp>
Date: Wed, 22 Dec 1999 00:07:16 +0000
Subject: [PATCH] to live in a transaction before access to db during backend
 startup.

---
 src/backend/tcop/postgres.c       | 10 +++++++---
 src/backend/utils/init/postinit.c |  5 ++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 619a9d9ba14..4764d32cdc3 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.137 1999/11/16 06:13:35 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.138 1999/12/22 00:07:15 inoue Exp $
  *
  * NOTES
  *	  this is the "main" module of the postgres backend and
@@ -1474,7 +1474,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
 
 	on_shmem_exit(remove_all_temp_relations, NULL);
 
-	parser_input = makeStringInfo(); /* initialize input buffer */
+	{
+		MemoryContext	oldcontext = MemoryContextSwitchTo(TopMemoryContext);
+		parser_input = makeStringInfo(); /* initialize input buffer */
+		MemoryContextSwitchTo(oldcontext);
+	}
 
 	/* 
 	 * Send this backend's cancellation info to the frontend. 
@@ -1495,7 +1499,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
 	if (!IsUnderPostmaster)
 	{
 		puts("\nPOSTGRES backend interactive interface ");
-		puts("$Revision: 1.137 $ $Date: 1999/11/16 06:13:35 $\n");
+		puts("$Revision: 1.138 $ $Date: 1999/12/22 00:07:15 $\n");
 	}
 
 	/*
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index c5b3f06b8cb..346bdb4b8b8 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.53 1999/11/21 01:58:21 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.54 1999/12/22 00:07:16 inoue Exp $
  *
  * NOTES
  *		InitPostgres() is the function called from PostgresMain
@@ -546,6 +546,9 @@ InitPostgres(char *name)		/* database name */
 	 */
 	InitCatalogCache();
 
+	/* start a new transaction here before access to db */
+	if (!bootstrap)
+		StartTransactionCommand();
 	/*
 	 * Set ourselves to the proper user id and figure out our postgres
 	 * user id.  If we ever add security so that we check for valid
-- 
GitLab