aboutsummaryrefslogtreecommitdiff
path: root/src/test/examples/testlibpq.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-01-22 16:52:31 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2021-01-22 16:52:31 -0500
commit58cd8dca3de0b3c7d378a412eca1f7289b5e4978 (patch)
tree6239036fa1062c2ecb7f2ac0474d64fa44d795c0 /src/test/examples/testlibpq.c
parent7cd9765f9bd3397b8d4d0f507021ef848b6d48d2 (diff)
downloadpostgresql-58cd8dca3de0b3c7d378a412eca1f7289b5e4978.tar.gz
postgresql-58cd8dca3de0b3c7d378a412eca1f7289b5e4978.zip
Avoid redundantly prefixing PQerrorMessage for a connection failure.
libpq's error messages for connection failures pretty well stand on their own, especially since commits 52a10224e/27a48e5a1. Prefixing them with 'could not connect to database "foo"' or the like is just redundant, and perhaps even misleading if the specific database name isn't relevant to the failure. (When it is, we trust that the backend's error message will include the DB name.) Indeed, psql hasn't used any such prefix in a long time. So, make all our other programs and documentation examples agree with psql's practice. Discussion: https://postgr.es/m/1094524.1611266589@sss.pgh.pa.us
Diffstat (limited to 'src/test/examples/testlibpq.c')
-rw-r--r--src/test/examples/testlibpq.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/test/examples/testlibpq.c b/src/test/examples/testlibpq.c
index 18c98083de9..0372781eaf2 100644
--- a/src/test/examples/testlibpq.c
+++ b/src/test/examples/testlibpq.c
@@ -43,8 +43,7 @@ main(int argc, char **argv)
/* Check to see that the backend connection was successfully made */
if (PQstatus(conn) != CONNECTION_OK)
{
- fprintf(stderr, "Connection to database failed: %s",
- PQerrorMessage(conn));
+ fprintf(stderr, "%s", PQerrorMessage(conn));
exit_nicely(conn);
}