summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorTom Lane2021-01-22 21:52:31 +0000
committerTom Lane2021-01-22 21:52:31 +0000
commit58cd8dca3de0b3c7d378a412eca1f7289b5e4978 (patch)
tree6239036fa1062c2ecb7f2ac0474d64fa44d795c0 /contrib
parent7cd9765f9bd3397b8d4d0f507021ef848b6d48d2 (diff)
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 'contrib')
-rw-r--r--contrib/oid2name/oid2name.c3
-rw-r--r--contrib/vacuumlo/vacuumlo.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c
index 5a884e29049..65cce499936 100644
--- a/contrib/oid2name/oid2name.c
+++ b/contrib/oid2name/oid2name.c
@@ -347,8 +347,7 @@ sql_conn(struct options *my_opts)
/* check to see that the backend connection was successfully made */
if (PQstatus(conn) == CONNECTION_BAD)
{
- pg_log_error("could not connect to database %s: %s",
- my_opts->dbname, PQerrorMessage(conn));
+ pg_log_error("%s", PQerrorMessage(conn));
PQfinish(conn);
exit(1);
}
diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c
index cdc2c02b8e8..dcb95c43204 100644
--- a/contrib/vacuumlo/vacuumlo.c
+++ b/contrib/vacuumlo/vacuumlo.c
@@ -124,8 +124,7 @@ vacuumlo(const char *database, const struct _param *param)
/* check to see that the backend connection was successfully made */
if (PQstatus(conn) == CONNECTION_BAD)
{
- pg_log_error("connection to database \"%s\" failed: %s",
- database, PQerrorMessage(conn));
+ pg_log_error("%s", PQerrorMessage(conn));
PQfinish(conn);
return -1;
}