pgsql: Remove trailing newlines in pg_upgrade's message strings.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Remove trailing newlines in pg_upgrade's message strings.
Дата
Msg-id E1oBLOL-002Tej-9f@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Remove trailing newlines in pg_upgrade's message strings.

pg_upgrade does not use common/logging.c, which is unfortunate
but changing it to do so seems like more work than is justified.
However, we really need to make it work more like common/logging.c
in one respect: the latter expects supplied message strings to not
end with a newline, instead adding one internally.  As it stands,
pg_upgrade's logging facilities expect a caller-supplied newline
in some cases and not others, which is already an invitation to bugs,
but the inconsistency with our other frontend code makes it worse.
There are already several places with missing or extra newlines,
and it's inevitable that there won't be more if we let this stand.

Hence, run around and get rid of all trailing newlines in message
strings, and add an Assert that there's not one, similar to the
existing Assert in common/logging.c.  Adjust the logging functions
to supply a newline at the right places.

(Some of these strings also have a *leading* newline, which would
be a good thing to get rid of too; but this patch doesn't attempt
that.)

There are some consequent minor changes in output.  The ones that
aren't outright bug fixes are generally removal of extra blank
lines that the original coding intentionally inserted.  It didn't
seem worth being bug-compatible with that.

Patch by me, reviewed by Kyotaro Horiguchi and Peter Eisentraut

Discussion: https://postgr.es/m/113191.1655233060@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7652353d87a6753627a6b6b36d7acd68475ea7c7

Modified Files
--------------
src/bin/pg_upgrade/check.c         | 118 ++++++++++++++--------------
src/bin/pg_upgrade/controldata.c   | 154 +++++++++++++++++++------------------
src/bin/pg_upgrade/exec.c          |  40 +++++-----
src/bin/pg_upgrade/file.c          |  44 +++++------
src/bin/pg_upgrade/function.c      |   6 +-
src/bin/pg_upgrade/info.c          |  17 ++--
src/bin/pg_upgrade/option.c        |  26 +++----
src/bin/pg_upgrade/parallel.c      |  14 ++--
src/bin/pg_upgrade/pg_upgrade.c    |  42 +++++-----
src/bin/pg_upgrade/pg_upgrade.h    |   3 +-
src/bin/pg_upgrade/relfilenumber.c |  12 +--
src/bin/pg_upgrade/server.c        |  18 ++---
src/bin/pg_upgrade/tablespace.c    |   8 +-
src/bin/pg_upgrade/util.c          |  82 ++++++++++++--------
src/bin/pg_upgrade/version.c       |  24 +++---
15 files changed, 317 insertions(+), 291 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: pgsql: Add copy/equal support for XID lists
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Improve error reporting from validate_exec().