Re: redundant error messages

From: Euler Taveira <euler(dot)taveira(at)2ndquadrant(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: redundant error messages
Date: 2020-11-05 13:34:06
Message-ID: CAH503wAbpk-isL-tCiM=FpaVD1Yb9NXtfw-M869KwEvaSRhi8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 5 Nov 2020 at 09:27, Peter Eisentraut <
peter(dot)eisentraut(at)enterprisedb(dot)com> wrote:

> A few client tools duplicate error messages already provided by libpq,
> such as
>
> pg_rewind: fatal: could not connect to server: could not connect to
> server: No such file or directory
>
> Good catch!

> Other client tools provide a different error message so in aggregate it
> looks like this:
>
> createdb: error: could not connect to database template1: could not
> connect to server: No such file or directory
>
> Is the database name important for this message? You should inform which
database you want to connect for all client tools except pg_dumpall. Hence,
you
already know which database has the connection problem. IMO the pg_dumpall
message should inform the database name. My suggestion is:

if (fail_on_error)
{
pg_log_error("database \"%s\": %s",
dbname, PQerrorMessage(conn));
exit_nicely(1);
}

and remove the redundant 'could not connect to database %s' from
scripts/common.c.

--
Euler Taveira http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2020-11-05 13:51:57 Re: pg_ls_tmpdir to show directories and shared filesets (and pg_ls_*)
Previous Message Hou, Zhijie 2020-11-05 13:02:52 RE: Parallel copy