diff --git a/src/backend/port/sysv_shmem.c b/src/backend/port/sysv_shmem.c
index fda3442c5b..8b70dab1a9 100644
--- a/src/backend/port/sysv_shmem.c
+++ b/src/backend/port/sysv_shmem.c
@@ -827,38 +827,6 @@ PGSharedMemoryReAttach(void)
 	UsedShmemSegAddr = hdr;		/* probably redundant */
 }
 
-/*
- * PGSharedMemoryNoReAttach
- *
- * This is called during startup of a postmaster child process when we choose
- * *not* to re-attach to the existing shared memory segment.  We must clean up
- * to leave things in the appropriate state.  This is not used in the non
- * EXEC_BACKEND case, either.
- *
- * The child process startup logic might or might not call PGSharedMemoryDetach
- * after this; make sure that it will be a no-op if called.
- *
- * UsedShmemSegID and UsedShmemSegAddr are implicit parameters to this
- * routine.  The caller must have already restored them to the postmaster's
- * values.
- */
-void
-PGSharedMemoryNoReAttach(void)
-{
-	Assert(UsedShmemSegAddr != NULL);
-	Assert(IsUnderPostmaster);
-
-#ifdef __CYGWIN__
-	/* cygipc (currently) appears to not detach on exec. */
-	PGSharedMemoryDetach();
-#endif
-
-	/* For cleanliness, reset UsedShmemSegAddr to show we're not attached. */
-	UsedShmemSegAddr = NULL;
-	/* And the same for UsedShmemSegID. */
-	UsedShmemSegID = 0;
-}
-
 #endif							/* EXEC_BACKEND */
 
 /*
diff --git a/src/backend/port/win32_shmem.c b/src/backend/port/win32_shmem.c
index ccd7b6b5e3..fa080222f6 100644
--- a/src/backend/port/win32_shmem.c
+++ b/src/backend/port/win32_shmem.c
@@ -431,41 +431,6 @@ PGSharedMemoryReAttach(void)
 	UsedShmemSegAddr = hdr;		/* probably redundant */
 }
 
-/*
- * PGSharedMemoryNoReAttach
- *
- * This is called during startup of a postmaster child process when we choose
- * *not* to re-attach to the existing shared memory segment.  We must clean up
- * to leave things in the appropriate state.
- *
- * The child process startup logic might or might not call PGSharedMemoryDetach
- * after this; make sure that it will be a no-op if called.
- *
- * ShmemProtectiveRegion, UsedShmemSegID and UsedShmemSegAddr are implicit
- * parameters to this routine.  The caller must have already restored them to
- * the postmaster's values.
- */
-void
-PGSharedMemoryNoReAttach(void)
-{
-	Assert(ShmemProtectiveRegion != NULL);
-	Assert(UsedShmemSegAddr != NULL);
-	Assert(IsUnderPostmaster);
-
-	/*
-	 * Under Windows we will not have mapped the segment, so we don't need to
-	 * un-map it.  Just reset UsedShmemSegAddr to show we're not attached.
-	 */
-	UsedShmemSegAddr = NULL;
-
-	/*
-	 * We *must* close the inherited shmem segment handle, else Windows will
-	 * consider the existence of this process to mean it can't release the
-	 * shmem segment yet.  We can now use PGSharedMemoryDetach to do that.
-	 */
-	PGSharedMemoryDetach();
-}
-
 /*
  * PGSharedMemoryDetach
  *
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 71ffb1345b..a10a9e0909 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -4834,8 +4834,8 @@ SubPostmasterMain(int argc, char *argv[])
 	/*
 	 * If appropriate, physically re-attach to shared memory segment. We want
 	 * to do this before going any further to ensure that we can attach at the
-	 * same address the postmaster used.  On the other hand, if we choose not
-	 * to re-attach, we may have other cleanup to do.
+	 * same address the postmaster used.  On the other hand, if we choose to
+	 * detach, get rid of any shared memory segment inherited previously.
 	 *
 	 * If testing EXEC_BACKEND on Linux, you should run this as root before
 	 * starting the postmaster:
@@ -4854,7 +4854,7 @@ SubPostmasterMain(int argc, char *argv[])
 		strncmp(argv[1], "--forkbgworker=", 15) == 0)
 		PGSharedMemoryReAttach();
 	else
-		PGSharedMemoryNoReAttach();
+		PGSharedMemoryDetach();
 
 	/* autovacuum needs this set before calling InitProcess */
 	if (strcmp(argv[1], "--forkavlauncher") == 0)
diff --git a/src/include/storage/pg_shmem.h b/src/include/storage/pg_shmem.h
index 0535d4545c..88ad1c8205 100644
--- a/src/include/storage/pg_shmem.h
+++ b/src/include/storage/pg_shmem.h
@@ -79,7 +79,6 @@ extern void *UsedShmemSegAddr;
 
 #ifdef EXEC_BACKEND
 extern void PGSharedMemoryReAttach(void);
-extern void PGSharedMemoryNoReAttach(void);
 #endif
 
 extern PGShmemHeader *PGSharedMemoryCreate(Size size, int port,
