Hi,

I noticed that in pg_backup_archiver.c, RestoreArchive() writes the dump header
using a hard-coded string:

       ahprintf(AH, "--\n-- PostgreSQL database dump\n--\n\n");

However, the macro TEXT_DUMP_HEADER (defined in the same file) already contains
exactly the same content.  To keep the code consistent and maintainable, this
patch replaces the hard-coded string with the macro.

A hard-coded version of TEXT_DUMPALL_HEADER exists in pg_dumpall.c, but since
it spans multiple files, it is left untouched.

-- 
Regards,
Japin Li
ChengDu WenWu Information Technology Co., Ltd.

>From a4e21376bd2d74594118089ab34a463895bcd6b2 Mon Sep 17 00:00:00 2001
From: Japin Li <[email protected]>
Date: Wed, 3 Jun 2026 15:18:20 +0800
Subject: [PATCH v1] Use TEXT_DUMP_HEADER instead of hard-coded dump header

---
 src/bin/pg_dump/pg_backup_archiver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c
index 2fd773ad84f..f2f4cd1bef0 100644
--- a/src/bin/pg_dump/pg_backup_archiver.c
+++ b/src/bin/pg_dump/pg_backup_archiver.c
@@ -466,7 +466,7 @@ RestoreArchive(Archive *AHX, bool append_data)
 	if (ropt->filename || ropt->compression_spec.algorithm != PG_COMPRESSION_NONE)
 		SetOutput(AH, ropt->filename, ropt->compression_spec, append_data);
 
-	ahprintf(AH, "--\n-- PostgreSQL database dump\n--\n\n");
+	ahprintf(AH, TEXT_DUMP_HEADER);
 
 	/*
 	 * If generating plain-text output, enter restricted mode to block any
-- 
2.53.0

Reply via email to