diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 198c97ecf5d921c42f3c955eb03be78a7fea98ac..b190cf51136f4a9c753695c5c988ceb9946fb286 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -4668,6 +4668,9 @@ SubPostmasterMain(int argc, char *argv[])
 	{
 		int			shmem_slot;
 
+		/* do this as early as possible; in particular, before InitProcess() */
+		IsBackgroundWorker = true;
+
 		/* Close the postmaster's sockets */
 		ClosePostmasterPorts(false);