From d3a07c4dd54bb4c1a5df9fc7412839c3112ba5e0 Mon Sep 17 00:00:00 2001
From: Fujii Masao <fujii@postgresql.org>
Date: Fri, 25 Jul 2025 23:46:01 +0900
Subject: [PATCH v1] Add regression test for background worker restart after
 crash.

Previously, if a background worker crashed and the server restarted
with restart_after_crash enabled, the worker was not restarted
as expected. This issue was fixed by commit b5d084c5353,
which ensures that background workers without the never-restart flag
are correctly restarted after a crash-and-restart cycle.

To guard against regressions, this commit adds a test that verifies
a background worker successfully restarts in such a scenario.
---
 src/test/recovery/t/013_crash_restart.pl | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/test/recovery/t/013_crash_restart.pl b/src/test/recovery/t/013_crash_restart.pl
index debfa635c36..fadbfb3c4f2 100644
--- a/src/test/recovery/t/013_crash_restart.pl
+++ b/src/test/recovery/t/013_crash_restart.pl
@@ -228,6 +228,13 @@ is( $node->safe_psql(
 	'before-orderly-restart',
 	'can still write after crash restart');
 
+# Confirm that the logical replication launcher, a background worker
+# without the never-restart flag, has also restarted successfully.
+is($node->safe_psql('postgres',
+	"SELECT count(*) = 1 FROM pg_stat_activity WHERE backend_type = 'logical replication launcher'"),
+	't',
+	'logical replication launcher restarted after crash');
+
 # Just to be sure, check that an orderly restart now still works
 $node->restart();
 
-- 
2.50.1

