| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| To: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
| Cc: | zhang_tian_chen(at)163(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: pg_resetwal: Fix wrong directory in log output |
| Date: | 2026-02-03 03:46:03 |
| Message-ID: | 7AB7BC2D-F592-4018-9EA1-A4683126B695@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Feb 3, 2026, at 10:25, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote:
>
> Hello.
>
> At Tue, 3 Feb 2026 10:13:53 +0800, Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> wrote in
>> The patch is straightforward and looks correct.
>
> Indeed, it does.
>
> However, the scoping of the define symbols in this file seems somewhat
> confused.
>
> For example:
>
>> static void
>> KillExistingArchiveStatus(void)
>> {
>> #define ARCHSTATDIR XLOGDIR "/archive_status"
>
> This define was presumably intended to be used only within the function,
> but since it is a macro, it can also be used from other functions, which
> appears to have contributed to this mistake.
>
> It would be better to clearly distinguish between file-scoped symbols
> and function-scoped ones. For function-local constants like this,
> using a 'static const char[] instead of a macro would make the
> intended scope explicit and help prevent similar issues.
>
Or we can just undef the macros before closing the functions.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ajin Cherian | 2026-02-03 03:48:25 | [PATCH] Support automatic sequence replication |
| Previous Message | Chao Li | 2026-02-03 03:37:36 | Re: walsender: Assert MyReplicationSlot is set before use |