From 354473fe17fab22399f6ce48c53e13839a3823cb Mon Sep 17 00:00:00 2001
From: Maxim Zibitsker <max.zibitsker@gmail.com>
Date: Thu, 30 Oct 2025 11:00:38 -0400
Subject: [PATCH] Support allocating memory for large strings

---
 src/backend/access/common/heaptuple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index 1173a6d81b5..e615fa9790a 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -1163,7 +1163,7 @@ heap_form_tuple(TupleDesc tupleDescriptor,
 	 * Allocate and zero the space needed.  Note that the tuple body and
 	 * HeapTupleData management structure are allocated in one chunk.
 	 */
-	tuple = (HeapTuple) palloc0(HEAPTUPLESIZE + len);
+	tuple = (HeapTuple) palloc_extended(HEAPTUPLESIZE + len, MCXT_ALLOC_HUGE | MCXT_ALLOC_ZERO);
 	tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
 
 	/*
-- 
2.32.1 (Apple Git-133)

