Re: Remove trailing newlines from pg_upgrade's messages - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Remove trailing newlines from pg_upgrade's messages
Date
Msg-id 448817.1655308437@sss.pgh.pa.us
Whole thread Raw
In response to Re: Remove trailing newlines from pg_upgrade's messages  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Responses Re: Remove trailing newlines from pg_upgrade's messages
List pgsql-hackers
Kyotaro Horiguchi <horikyota.ntt@gmail.com> writes:
> Also leading newlines and just "\n" bug me when I edit message
> catalogues with poedit. I might want a line-spacing function like
> pg_log_newline(PG_REPORT) if we need line-breaks in the ends of a
> message.

Yeah, that is sort of the inverse problem.  I think those are there
to ensure that the text appears on a fresh line even if the current
line has transient status on it.  We could get rid of those perhaps
if we teach pg_log_v to remember whether it ended the last output
with a newline or not, and then put out a leading newline only if
necessary, rather than hard-wiring one into the message texts.

This might take a little bit of fiddling to make it work, because
we'd not want the extra newline when completing an incomplete line
by adding status.  That would mean that report_status would have
to do something special, plus we'd have to be sure that all such
cases do go through report_status rather than calling pg_log
directly.  (I'm fairly sure that the code is sloppy about that
today :-(.)  It seems probably do-able, though.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Álvaro Herrera
Date:
Subject: Re: support for MERGE
Next
From: Robert Haas
Date:
Subject: Re: better page-level checksums