From 3fe57d92c9ce4fa637e969b2365fec90e73be794 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 5 Aug 2026 21:11:21 +0200 Subject: [PATCH v2 5/5] Use frontend logging API in fe_utils/string_utils.c This simplifies error message printing a bit. Author: Chao Li Discussion: https://www.postgresql.org/message-id/flat/c855d318-4545-4dc7-b466-2e24fbf64725%40eisentraut.org --- src/fe_utils/string_utils.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/fe_utils/string_utils.c b/src/fe_utils/string_utils.c index 7a762251f32..f99ce8d80b6 100644 --- a/src/fe_utils/string_utils.c +++ b/src/fe_utils/string_utils.c @@ -18,6 +18,7 @@ #include #include "common/keywords.h" +#include "common/logging.h" #include "fe_utils/string_utils.h" #include "mb/pg_wchar.h" @@ -580,12 +581,7 @@ void appendShellString(PQExpBuffer buf, const char *str) { if (!appendShellStringNoError(buf, str)) - { - fprintf(stderr, - _("shell command argument contains a newline or carriage return: \"%s\"\n"), - str); - exit(EXIT_FAILURE); - } + pg_fatal("shell command argument contains a newline or carriage return: \"%s\"", str); } bool @@ -753,12 +749,7 @@ appendPsqlMetaConnect(PQExpBuffer buf, const char *dbname) for (s = dbname; *s; s++) { if (*s == '\n' || *s == '\r') - { - fprintf(stderr, - _("database name contains a newline or carriage return: \"%s\"\n"), - dbname); - exit(EXIT_FAILURE); - } + pg_fatal("database name contains a newline or carriage return: \"%s\"", dbname); if (!((*s >= 'a' && *s <= 'z') || (*s >= 'A' && *s <= 'Z') || (*s >= '0' && *s <= '9') || *s == '_' || *s == '.')) -- 2.55.0