From a2e46d2dc10bd31d63c6a6bb44334e069b2a9605 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Tue, 17 Feb 2026 14:27:43 +0300
Subject: [PATCH] Fix creating stamp file in the libpq_check.pl

We don't create stamp files if it already exists. This is wrong, stamp
file needs to be newer than the inputs. If the stamp file is older than
the inputs, it will cause rebuilding.

Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/19095-6d8256d0c37d4be2@postgresql.org
---
 src/interfaces/libpq/libpq_check.pl | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/interfaces/libpq/libpq_check.pl b/src/interfaces/libpq/libpq_check.pl
index 8a2e29b2d9a..833f5315c3c 100755
--- a/src/interfaces/libpq/libpq_check.pl
+++ b/src/interfaces/libpq/libpq_check.pl
@@ -31,12 +31,9 @@ die "$0: --nm must be specified\n" unless defined $nm_path and -x $nm_path;
 
 sub create_stamp_file
 {
-	if (!(-f $stamp_file))
-	{
-		open my $fh, '>', $stamp_file
-		  or die "can't open $stamp_file: $!";
-		close $fh;
-	}
+	open my $fh, '>', $stamp_file
+	  or die "can't open $stamp_file: $!";
+	close $fh;
 }
 
 # Skip on Windows and Solaris
-- 
2.47.3

