From 58cd8dca3de0b3c7d378a412eca1f7289b5e4978 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 22 Jan 2021 16:52:31 -0500 Subject: 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 --- src/interfaces/ecpg/ecpglib/connect.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/interfaces/ecpg/ecpglib/connect.c') diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index 1cb52116f95..6b0a3067e6c 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -652,7 +652,8 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p const char *errmsg = PQerrorMessage(this->connection); const char *db = realname ? realname : ecpg_gettext(""); - ecpg_log("ECPGconnect: could not open database: %s\n", errmsg); + /* PQerrorMessage's result already has a trailing newline */ + ecpg_log("ECPGconnect: %s", errmsg); ecpg_finish(this); #ifdef ENABLE_THREAD_SAFETY -- cgit v1.2.3