From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: strange error reporting
Date: Tue, 26 Jan 2021 16:52:24 -0300
Message-ID: <20210126195224.GA20361@alvherre.pgsql> (raw)
In-Reply-To: <CA+TgmoZ2N+tWm_xMboSQnpUbgrV6fCVu8_TEYBWY2fhdnMqX4g@mail.gmail.com>
On 2021-Jan-20, Robert Haas wrote:
> On Wed, Jan 20, 2021 at 1:54 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > > Well, the patch seems small enough, and I don't think it'll be in any
> > > way helpful to omit that detail.
> >
> > I'm +1 for applying and back-patching that. I still think we might
> > want to just drop the phrase altogether in HEAD, but we wouldn't do
> > that in the back branches, and the message is surely misleading as-is.
>
> Sure, that makes sense.
OK, I pushed it. Thanks,
pgbench has one occurrence of the old pattern in master, in line 6043.
However, since doConnect() returns NULL when it gets CONNECTION_BAD,
that seems dead code. This patch kills it.
--
Álvaro Herrera 39°49'30"S 73°17'W
"I can see support will not be a problem. 10 out of 10." (Simon Wittber)
(http://archives.postgresql.org/pgsql-general/2004-12/msg00159.php)
Attachments:deadcode.patch (text/x-diff, 606B) downloaddiff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.cindex 1be1ad3d6d..a4a3f40048 100644--- a/src/bin/pgbench/pgbench.c+++ b/src/bin/pgbench/pgbench.c@@ -6038,17 +6038,10 @@ main(int argc, char **argv)
/* opening connection... */
con = doConnect();
if (con == NULL)
exit(1);
- if (PQstatus(con) == CONNECTION_BAD)- {- pg_log_fatal("connection to database \"%s\" failed: %s",- dbName, PQerrorMessage(con));- exit(1);- }-
if (internal_script_used)
GetTableInfo(con, scale_given);
/*
* :scale variables normally get -s or database scale, but don't override
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, robertmhaas@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: strange error reporting
In-Reply-To: <20210126195224.GA20361@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox