Fix redundant error messages in client tools
authorPeter Eisentraut <[email protected]>
Sat, 7 Nov 2020 21:15:52 +0000 (22:15 +0100)
committerPeter Eisentraut <[email protected]>
Sat, 7 Nov 2020 21:44:48 +0000 (22:44 +0100)
A few client tools duplicate error messages already provided by libpq.

Discussion: https://www.postgresql.org/message-id/flat/3e937641-88a1-e697-612e-99bba4b8e5e4%40enterprisedb.com

src/bin/pg_basebackup/streamutil.c
src/bin/pg_rewind/libpq_fetch.c

index a240aae9f2f70a23a568528681d069b895eda96a..882ba4b50a5e42aca4ecb6bfb35571527bb1ed18 100644 (file)
@@ -190,8 +190,7 @@ GetConnection(void)
 
    if (PQstatus(tmpconn) != CONNECTION_OK)
    {
-       fprintf(stderr, _("%s: could not connect to server: %s"),
-               progname, PQerrorMessage(tmpconn));
+       fprintf(stderr, _("%s: %s"), progname, PQerrorMessage(tmpconn));
        PQfinish(tmpconn);
        free(values);
        free(keywords);
index 2c0c5723f794ceab9fcf55cc1f8e1ecf93bec231..583752ab20067e1933db9fbcdeddd0286daad81a 100644 (file)
@@ -54,8 +54,7 @@ libpqConnect(const char *connstr)
 
    conn = PQconnectdb(connstr);
    if (PQstatus(conn) == CONNECTION_BAD)
-       pg_fatal("could not connect to server: %s",
-                PQerrorMessage(conn));
+       pg_fatal("%s", PQerrorMessage(conn));
 
    pg_log(PG_PROGRESS, "connected to server\n");