From: Fabien COELHO <coelho@cri.ensmp.fr>
To: Julien Rouhaud <julien.rouhaud@dalibo.com>
Cc: Guillaume Lelarge <guillaume@lelarge.info>
Cc: mail@bwe.im, Oleksandr Shulgin <oleksandr.shulgin@zalando.de>
Cc: PostgreSQL Bugs List <pgsql-bugs@postgresql.org>
Subject: Re: BUG #12379: pgbench should hint to pgbench -i
Date: Sun, 5 Jul 2015 18:28:22 +0200 (CEST)
Message-ID: <alpine.DEB.2.10.1507051821230.27775@sto> (raw)
In-Reply-To: <559908D4.7020901@dalibo.com>
References: <20141231105955.8014.38426@wrigleys.postgresql.org>
<alpine.DEB.2.10.1503080851220.4406@sto>
<alpine.DEB.2.10.1504260845160.6827@sto>
<87oales6zm.fsf@ashulgin01.corp.ad.zalando.net>
<alpine.DEB.2.10.1505221131480.30229@sto>
<55984046.60901@dalibo.com>
<CAECtzeWOm0JmJpDwM=woq8mfqfjPHOxLvSAaPrs=qOHvbWzxkw@mail.gmail.com>
<559908D4.7020901@dalibo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Hello Guillaume & Julien,
Thanks for the comments and the improvements!
>> I can't look at the code right now, but doesn't it use PQdb() to get the
>> name of the database? If it doesn't, it probably should.
>
> I'm attaching a new version of the patch, which retrieves the actual
> database name once connected if needed. That only solves this message
> though, the other ones being displayed before the connection is available.
I'm not sure it is worth bothering with setting dbname which seems not to
be used afterwards anyway. I would suggest to coldly call PQdb on the
connection for the error message and thus simplify the code, as attached.
--
Fabien.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugsAttachments:pgbench-hint-6.patch (text/x-diff, 504B) downloaddiff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.cindex 95be62c..43941ad 100644--- a/src/bin/pgbench/pgbench.c+++ b/src/bin/pgbench/pgbench.c@@ -3241,6 +3241,8 @@ main(int argc, char **argv)
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "%s", PQerrorMessage(con));
+ fprintf(stderr, "HINT pgbench: is \"%s\" the right database? "+ "did you initialize first (-i)?\n", PQdb(con));
exit(1);
}
scale = atoi(PQgetvalue(res, 0, 0));
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: coelho@cri.ensmp.fr, julien.rouhaud@dalibo.com, guillaume@lelarge.info, oleksandr.shulgin@zalando.de
Subject: Re: BUG #12379: pgbench should hint to pgbench -i
In-Reply-To: <alpine.DEB.2.10.1507051821230.27775@sto>
References: <20141231105955.8014.38426@wrigleys.postgresql.org> <alpine.DEB.2.10.1503080851220.4406@sto> <alpine.DEB.2.10.1504260845160.6827@sto> <87oales6zm.fsf@ashulgin01.corp.ad.zalando.net> <alpine.DEB.2.10.1505221131480.30229@sto> <55984046.60901@dalibo.com> <CAECtzeWOm0JmJpDwM=woq8mfqfjPHOxLvSAaPrs=qOHvbWzxkw@mail.gmail.com> <559908D4.7020901@dalibo.com> <alpine.DEB.2.10.1507051821230.27775@sto>
* 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