From 91daa6b5060e2c2ea1f0e9b57fba8eb6a90bf71f Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavuz81@gmail.com>
Date: Wed, 16 Sep 2026 15:05:37 +0300
Subject: [PATCH v1] Fix comments after returning paths by value

Commit ecbff4378be changed _mdfd_segpath() to return an MdPathStr by
value, but left its comment claiming that the result was palloc'd.
Correct that description, and fix the maximum-length path example
introduced by 37c87e63f9e to use the actual member name and include
the fork suffix.
---
 src/backend/storage/smgr/md.c | 3 +--
 src/include/common/relpath.h  | 4 ++--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 780c88c0630..70bf483196a 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -1685,8 +1685,7 @@ _fdvec_resize(SMgrRelation reln,
 }
 
 /*
- * Return the filename for the specified segment of the relation. The
- * returned string is palloc'd.
+ * Return the filename for the specified segment of the relation.
  */
 static MdPathStr
 _mdfd_segpath(SMgrRelation reln, ForkNumber forknum, BlockNumber segno)
diff --git a/src/include/common/relpath.h b/src/include/common/relpath.h
index 9772125be73..852d6badddc 100644
--- a/src/include/common/relpath.h
+++ b/src/include/common/relpath.h
@@ -86,10 +86,10 @@ extern int	forkname_chars(const char *str, ForkNumber *fork);
 
 /*
  * The longest possible relation path lengths is from the following format:
- * sprintf(rp.path, "%s/%u/%s/%u/t%d_%u",
+ * sprintf(rp.path, "%s/%u/%s/%u/t%d_%u_%s",
  *         PG_TBLSPC_DIR, spcOid,
  *         TABLESPACE_VERSION_DIRECTORY,
- *         dbOid, procNumber, relNumber);
+ *         dbOid, procNumber, relNumber, forkNames[forkNumber]);
  *
  * Note this does *not* include the trailing null-byte, to make it easier to
  * combine it with other lengths.
-- 
2.47.3

