From 6ef54e90ec5eeb92ec8bd857f6d6f35578f058b9 Mon Sep 17 00:00:00 2001
From: Jacob Champion <jacob.champion@enterprisedb.com>
Date: Wed, 5 Mar 2025 08:13:22 -0800
Subject: [PATCH 2/2] squash! Fix race condition in pre-auth test

Wait only for client backends.
---
 src/test/authentication/t/007_pre_auth.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/test/authentication/t/007_pre_auth.pl b/src/test/authentication/t/007_pre_auth.pl
index 90aaea4b5a6..12e40dc722c 100644
--- a/src/test/authentication/t/007_pre_auth.pl
+++ b/src/test/authentication/t/007_pre_auth.pl
@@ -50,7 +50,9 @@ while (1)
 {
 	$pid = $psql->query(
 		qq{SELECT pid FROM pg_stat_activity
-  WHERE state = 'starting' and wait_event = 'init-pre-auth';});
+  WHERE backend_type = 'client backend'
+    AND state = 'starting'
+    AND wait_event = 'init-pre-auth';});
 	last if $pid ne "";
 
 	usleep(100_000);
-- 
2.34.1

