Hi,
The test case seems to have a problem:
We cannot ensure that the SELECT happens after the pg_stat_activity can show the logical replication launcher.
With the following patch the test will fail (without the patch it may happen very rarely):
diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c
index 742d9ba68e9..1e155587c55 100644
--- a/src/backend/replication/logical/launcher.c
+++ b/src/backend/replication/logical/launcher.c
@@ -1162,6 +1162,7 @@ ApplyLauncherMain(Datum main_arg)
* Establish connection to nailed catalogs (we only ever access
* pg_subscription).
*/
+ sleep(100);
BackgroundWorkerInitializeConnection(NULL, NULL, 0);
/*