diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 24e8404..2076d96 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -4637,6 +4637,16 @@ SubPostmasterMain(int argc, char *argv[]) strncmp(argv[1], "--forkbgworker=", 15) == 0) PGSharedMemoryReAttach(); + /* + * Close any existing shared memory segment as those processes do not + * need to have an access to it. This state is inherited from the + * postmaster whether they need it or not. + */ + if (strcmp(argv[1], "--forkarch") == 0 || + strcmp(argv[1], "--forkcol") == 0 || + strcmp(argv[1], "--forklog") == 0) + PGSharedMemoryDetach(); + /* autovacuum needs this set before calling InitProcess */ if (strcmp(argv[1], "--forkavlauncher") == 0) AutovacuumLauncherIAm();