From 05391a967a025ceba396b67a86b7f651c0627782 Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <aleksander@tigerdata.com>
Date: Tue, 18 Aug 2026 17:44:08 +0300
Subject: [PATCH v1 1/2] pg_dump: remove unused ArchiveHandle.lookaheadSize
 field

_discoverArchiveFormat() set this field to the size it passed to pg_malloc0(),
but no code has ever read it since it was added. The other places that need
the capacity of the lookahead buffer spell out 512 directly, and rightly so:
the value is really the tar block size, which is what makes the buffer large
enough to hold a tar header for isValidTarHeader() to inspect.

Oversight in e8f69be054e.

Author: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: TODO FIXME
Discussion: TODO FIXME
---
 src/bin/pg_dump/pg_backup_archiver.c | 1 -
 src/bin/pg_dump/pg_backup_archiver.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index d7da3fc4325..c2aa7e5669e 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -2252,7 +2252,6 @@ _discoverArchiveFormat(ArchiveHandle *AH)
 	pg_free(AH->lookahead);
 
 	AH->readHeader = 0;
-	AH->lookaheadSize = 512;
 	AH->lookahead = pg_malloc0(512);
 	AH->lookaheadLen = 0;
 	AH->lookaheadPos = 0;
diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h
index c1528d78853..e2b1cff610e 100644
--- a/src/bin/pg_dump/pg_backup_archiver.h
+++ b/src/bin/pg_dump/pg_backup_archiver.h
@@ -244,7 +244,6 @@ struct _archiveHandle
 	int			readHeader;		/* Set if we already read "PGDMP" marker */
 	char	   *lookahead;		/* Buffer used when reading header to discover
 								 * format */
-	size_t		lookaheadSize;	/* Allocated size of buffer */
 	size_t		lookaheadLen;	/* Length of valid data in lookahead */
 	size_t		lookaheadPos;	/* Current read position in lookahead buffer */
 
-- 
2.43.0

