From 15658911d9947cda031a42bcbc3e2b745dff8f49 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed, 2 Jan 2013 17:49:06 -0300
Subject: [PATCH] Set MaxBackends only on bootstrap and standalone modes

... not on auxiliary processes.  I managed to overlook the fact that I
had disabled assertions on my HEAD checkout long ago.

Hopefully this will turn the buildfarm green again, and put an end to
today's silliness.
---
 src/backend/tcop/postgres.c       | 5 +++++
 src/backend/utils/init/postinit.c | 2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index e3a4db5de24..937191334fc 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3653,6 +3653,11 @@ PostgresMain(int argc, char *argv[], const char *username)
 		 * Create lockfile for data directory.
 		 */
 		CreateDataDirLockFile(false);
+
+		/* In EXEC_BACKEND, this was set via BackendParameters */
+#ifndef EXEC_BACKEND
+		InitializeMaxBackends();
+#endif
 	}
 
 	/* Early initialization */
diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c
index 3948eac039b..ddd79d0aa2d 100644
--- a/src/backend/utils/init/postinit.c
+++ b/src/backend/utils/init/postinit.c
@@ -453,8 +453,6 @@ InitializeMaxBackends(void)
 void
 BaseInit(void)
 {
-	InitializeMaxBackends();
-
 	/*
 	 * Attach to shared memory and semaphores, and initialize our
 	 * input/output/debugging file descriptors.
-- 
GitLab