Re: Quoting filename in using facing log messages

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Quoting filename in using facing log messages
Date: 2023-09-13 12:02:47
Message-ID: EFFD4A1E-73A4-4616-9CC5-84FA25399F6F@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 13 Sep 2023, at 13:55, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 13.09.23 13:48, Daniel Gustafsson wrote:
>> Looking at ZQFUGOuS5DU4DsE4(at)paquier(dot)xyz I noticed that we had a a few instances
>> of filenames in userfacing log messages (ie not elog or DEBUGx etc) not being
>> quoted, where the vast majority are quoted like \"%s\". Any reason not to
>> quote them as per the attached to be consistent across all log messages?
>
> Since WAL file names have a predictable format, there is less pressure to quote them to avoid ambiguities. But in general we should try to be consistent

Correct, this is all for consistency.

> so your patch makes sense to me.

Thanks!

It might be worth concatenating the errmsg() while there since we typically
don't linebreak errmsg strings anymore for greppability:

- errmsg("could not write to log file %s "
- "at offset %u, length %zu: %m",
+ errmsg("could not write to log file \"%s\" at offset %u, length %zu: %m",

I don't have strong feelings wrt that, just have a vague memory of "concatenate
when touching" as an informal guideline.

--
Daniel Gustafsson

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2023-09-13 12:20:57 Re: make add_paths_to_append_rel aware of startup cost
Previous Message Peter Eisentraut 2023-09-13 11:55:57 Re: Quoting filename in using facing log messages