From 7b5689cf8a00935fa326e873ecd034bc88a1a9fa Mon Sep 17 00:00:00 2001
From: Lei Yang <yanglei.ovo@gmail.com>
Date: Wed, 15 Jul 2026 23:27:12 +0800
Subject: [PATCH] The heap_getsysattr function deletes unused parameters

---
 src/backend/access/common/heaptuple.c  | 2 +-
 src/backend/executor/execTuples.c      | 6 ++----
 src/backend/utils/adt/expandedrecord.c | 3 +--
 src/include/access/htup_details.h      | 5 ++---
 4 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index f30346469ed..81eb3b1d2ae 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -630,7 +630,7 @@ nocachegetattr(HeapTuple tup,
  * ----------------
  */
 Datum
-heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
+heap_getsysattr(HeapTuple tup, int attnum, bool *isnull)
 {
 	Datum		result;
 
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 97ae019d10a..cc3171b9c0d 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -368,8 +368,7 @@ tts_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot retrieve a system column in this context")));
 
-	return heap_getsysattr(hslot->tuple, attnum,
-						   slot->tts_tupleDescriptor, isnull);
+	return heap_getsysattr(hslot->tuple, attnum, isnull);
 }
 
 static bool
@@ -773,8 +772,7 @@ tts_buffer_heap_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
 				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
 				 errmsg("cannot retrieve a system column in this context")));
 
-	return heap_getsysattr(bslot->base.tuple, attnum,
-						   slot->tts_tupleDescriptor, isnull);
+	return heap_getsysattr(bslot->base.tuple, attnum, isnull);
 }
 
 static bool
diff --git a/src/backend/utils/adt/expandedrecord.c b/src/backend/utils/adt/expandedrecord.c
index 123792aa725..ece317e62a9 100644
--- a/src/backend/utils/adt/expandedrecord.c
+++ b/src/backend/utils/adt/expandedrecord.c
@@ -1090,8 +1090,7 @@ expanded_record_fetch_field(ExpandedRecordHeader *erh, int fnumber,
 			*isnull = true;
 			return (Datum) 0;
 		}
-		/* heap_getsysattr doesn't actually use tupdesc, so just pass null */
-		return heap_getsysattr(erh->fvalue, fnumber, NULL, isnull);
+		return heap_getsysattr(erh->fvalue, fnumber, isnull);
 	}
 }
 
diff --git a/src/include/access/htup_details.h b/src/include/access/htup_details.h
index 77a6c48fd71..5eec3f8a52d 100644
--- a/src/include/access/htup_details.h
+++ b/src/include/access/htup_details.h
@@ -801,8 +801,7 @@ extern void heap_fill_tuple(TupleDesc tupleDesc,
 extern bool heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc);
 extern Datum nocachegetattr(HeapTuple tup, int attnum,
 							TupleDesc tupleDesc);
-extern Datum heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
-							 bool *isnull);
+extern Datum heap_getsysattr(HeapTuple tup, int attnum, bool *isnull);
 extern Datum getmissingattr(TupleDesc tupleDesc,
 							int attnum, bool *isnull);
 extern HeapTuple heap_copytuple(HeapTuple tuple);
@@ -902,7 +901,7 @@ heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
 			return fastgetattr(tup, attnum, tupleDesc, isnull);
 	}
 	else
-		return heap_getsysattr(tup, attnum, tupleDesc, isnull);
+		return heap_getsysattr(tup, attnum, isnull);
 }
 #endif							/* FRONTEND */
 
-- 
2.34.1

