Skip to content

Commit 6be725e

Browse files
committed
Fix redundant error messages in client tools
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
1 parent eed4356 commit 6be725e

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/bin/pg_basebackup/streamutil.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ GetConnection(void)
200200

201201
if (PQstatus(tmpconn) != CONNECTION_OK)
202202
{
203-
pg_log_error("could not connect to server: %s",
204-
PQerrorMessage(tmpconn));
203+
pg_log_error("%s", PQerrorMessage(tmpconn));
205204
PQfinish(tmpconn);
206205
free(values);
207206
free(keywords);

src/bin/pg_rewind/pg_rewind.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,7 @@ main(int argc, char **argv)
282282
conn = PQconnectdb(connstr_source);
283283

284284
if (PQstatus(conn) == CONNECTION_BAD)
285-
pg_fatal("could not connect to server: %s",
286-
PQerrorMessage(conn));
285+
pg_fatal("%s", PQerrorMessage(conn));
287286

288287
if (showprogress)
289288
pg_log_info("connected to server");

src/bin/psql/startup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ main(int argc, char *argv[])
295295

296296
if (PQstatus(pset.db) == CONNECTION_BAD)
297297
{
298-
pg_log_error("could not connect to server: %s", PQerrorMessage(pset.db));
298+
pg_log_error("%s", PQerrorMessage(pset.db));
299299
PQfinish(pset.db);
300300
exit(EXIT_BADCONN);
301301
}

0 commit comments

Comments
 (0)