Re: Use TEXT_DUMP_HEADER macro instead of hard-coded string in pg_backup_archiver.c

From: Japin Li <japinli(at)hotmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Use TEXT_DUMP_HEADER macro instead of hard-coded string in pg_backup_archiver.c
Date: 2026-06-03 09:07:25
Message-ID: SY7PR01MB10921903E353F15290857D08AB6132@SY7PR01MB10921.ausprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi, Daniel

On Wed, 03 Jun 2026 at 10:14, Daniel Gustafsson <daniel(at)yesql(dot)se> wrote:
>> On 3 Jun 2026, at 09:58, Japin Li <japinli(at)hotmail(dot)com> wrote:
>>
>>
>> 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.
>
> Seems reasonable.
>

Thanks for your review.

>> A hard-coded version of TEXT_DUMPALL_HEADER exists in pg_dumpall.c, but since
>> it spans multiple files, it is left untouched.
>
> The alternative would be to move the definitions to pg_backup_archiver.h and
> use them consistently.
>

Fixed as you suggested.

> --
> Daniel Gustafsson

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

Attachment Content-Type Size
v2-0001-Replace-the-hard-coded-dump-headers-with-macros.patch text/x-patch 2.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Oleg Bartunov 2026-06-03 09:20:35 Re: hashjoins vs. Bloom filters (yet again)
Previous Message Dean Rasheed 2026-06-03 08:40:43 Re: [PATCH] Fix overflow and underflow in regr_r2()