Subject: [PATCH 6/9] use 'int' instead of 'uint32' for the result of list_length

From: Álvaro Herrera <[email-masked]>
Date: Thu, 12 Mar 2026 16:12:13 +0100

---
 src/backend/commands/cluster.c                            | 2 +-
 src/backend/replication/pgoutput_repack/pgoutput_repack.c | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 29440fb75cd..244843ee1cf 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -3113,7 +3113,7 @@ restore_tuple(BufFile *file, Relation relation, MemoryContext cxt)
 	uint32		t_len;
 	HeapTuple	tup;
 	MemoryContext oldcxt;
-	uint32		natt_ext;
+	int			natt_ext;
 	List	   *attrs_ext = NIL;
 
 	oldcxt = MemoryContextSwitchTo(cxt);
diff --git a/src/backend/replication/pgoutput_repack/pgoutput_repack.c b/src/backend/replication/pgoutput_repack/pgoutput_repack.c
index 79fc611b9ff..61cd7c52ae6 100644
--- a/src/backend/replication/pgoutput_repack/pgoutput_repack.c
+++ b/src/backend/replication/pgoutput_repack/pgoutput_repack.c
@@ -175,7 +175,7 @@ store_change(LogicalDecodingContext *ctx, Relation relation,
 	BufFile    *file;
 	char		kind_byte = (char) kind;
 	List	   *attrs_ext = NIL;
-	uint32		natt_ext;
+	int			natt_ext;
 
 	dstate = (RepackDecodingState *) ctx->output_writer_private;
 	file = dstate->file;
@@ -237,14 +237,12 @@ store_change(LogicalDecodingContext *ctx, Relation relation,
 				Assert(VARATT_IS_EXTERNAL_ONDISK(varlena_pointer));
 			}
 		}
-		natt_ext = list_length(attrs_ext);
 	}
-	else
-		natt_ext = 0;
 
 	/* Write the number of external attributes. */
+	natt_ext = list_length(attrs_ext);
 	BufFileWrite(file, &natt_ext, sizeof(natt_ext));
-	/* ... and the attributes themselves, if there are some. */
+	/* ... and the attributes themselves, if any */
 	foreach_ptr(varlena, attr_val, attrs_ext)
 	{
 		varlena    *ext_val;
-- 
2.47.3

--pnppmxqkefjd4hu2
Content-Type: text/plain; charset=utf-8
Content-Disposition: attachment;
	filename="0007-no-need-for-palloc0-here-simple-palloc-is-enough.nocfbot.txt"