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

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Japin Li <japinli(at)hotmail(dot)com>
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 08:14:47
Message-ID: F3F76C36-B770-40C2-9FD7-CA9F2C168637@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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.

> 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.

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-06-03 08:17:24 Re: Fix bug of CHECK constraint enforceability recursion
Previous Message yangboyu 2026-06-03 08:13:44 Optimize RelfilenumberMapInvalidateCallback for logical decoding performance