From 4b01649d52fac9b01566a7a569f27bf3e06841bb Mon Sep 17 00:00:00 2001
From: Andrey Rudometov <unlimitedhikari@gmail.com>
Date: Wed, 11 Jun 2025 11:18:45 +0700
Subject: [PATCH v1 2/2] Fix bgw not starting after restart_after_crash

If postgres assumes child as crashed and said child is background
worker, and restart_after_crash is set - this bgw's local data
won't be cleared; p.e. rw_pid will remain set, so this bgw won't
be restarted later.
---
 src/backend/postmaster/postmaster.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 2d99f9d670d..b6d46cd84a7 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2633,7 +2633,7 @@ CleanupBackend(PMChild *bp,
 	if (crashed)
 	{
 		HandleChildCrash(bp_pid, exitstatus, procname);
-		return;
+		logged = true;
 	}
 
 	/*
-- 
2.43.0

