Re: CheckMyDatabase some error messages in two lines.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: CheckMyDatabase some error messages in two lines.
Date: 2024-06-10 02:12:53
Message-ID: 620742.1717985573@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Nathan Bossart <nathandbossart(at)gmail(dot)com> writes:
> On Mon, Jun 10, 2024 at 08:00:00AM +0800, jian he wrote:
>> - errdetail("The database was initialized with LC_COLLATE \"%s\", "
>> - " which is not recognized by setlocale().", collate),
>> + errdetail("The database was initialized with LC_COLLATE \"%s\", which is not recognized by setlocale().", collate),

> Both approaches produce the same message. With the existing code, the two
> string literals will be concatenated without newlines. It is probably
> split into two lines to avoid a long line in the source code.

No doubt. People have done it both ways in the past, but I think
currently there's a weak consensus in favor of using one line for
such messages even when it runs past 80 columns, mainly because
that makes it easier to grep the source code for a message text.

But: I don't see too much value in changing this particular instance,
because the line break is in a place where it would not likely cause
you to miss finding the line. You might grep for the first part of
the string or the second part, but probably not for ", which is not".
If the line break were in the middle of a phrase, there'd be more
argument for collapsing it out.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-06-10 02:30:16 Re: Assert in heapgettup_pagemode() fails due to underlying buffer change
Previous Message Nathan Bossart 2024-06-10 02:02:37 Re: CheckMyDatabase some error messages in two lines.