diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 9ff3069504e05b1b791fc81351a53ea7be527008..ea1af8ccbba2ec8b5400d3c91b8140d7ef92c4c1 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7627,7 +7627,7 @@ HotStandbyActive(void)
 bool
 HotStandbyActiveInReplay(void)
 {
-	Assert(AmStartupProcess());
+	Assert(AmStartupProcess() || !IsPostmasterEnvironment);
 	return LocalHotStandbyActive;
 }