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:45:32 +0000 (22:45 +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 b4fa9f59d25bf1289042de473792c8f07444d93f..23ef13abdc3ca40d67474302d7ed087409648e51 100644 (file)
@@ -193,8 +193,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 bb5a83648a4be51b530ebbeac1c45ef8b53d1c3d..f7e844cd6c2dacaeee8389b701f523b481aa251a 100644 (file)
@@ -55,8 +55,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");