Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZBTwu-0006QV-Dw for pgsql-bugs@arkaria.postgresql.org; Sat, 04 Jul 2015 20:22:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZBTwt-0001Nn-8b for pgsql-bugs@arkaria.postgresql.org; Sat, 04 Jul 2015 20:22:07 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZBTwr-0001NO-Oi for pgsql-bugs@postgresql.org; Sat, 04 Jul 2015 20:22:05 +0000 Received: from mimolette.dalibo.net ([212.85.154.222]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZBTwo-0002uA-FG for pgsql-bugs@postgresql.org; Sat, 04 Jul 2015 20:22:04 +0000 Received: from [192.168.0.4] (aur75-1-78-192-238-147.fbxo.proxad.net [78.192.238.147]) by mimolette.dalibo.net (Postfix) with ESMTPSA id 4156F6095BE; Sat, 4 Jul 2015 22:21:27 +0200 (CEST) Message-ID: <55984046.60901@dalibo.com> Date: Sat, 04 Jul 2015 22:21:26 +0200 From: Julien Rouhaud User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Fabien COELHO , Oleksandr Shulgin CC: mail@bwe.im, pgsql-bugs@postgresql.org Subject: Re: BUG #12379: pgbench should hint to pgbench -i References: <20141231105955.8014.38426@wrigleys.postgresql.org> <87oales6zm.fsf@ashulgin01.corp.ad.zalando.net> In-Reply-To: Content-Type: multipart/mixed; boundary="------------000708060608020600000507" X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------000708060608020600000507 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 22/05/2015 11:33, Fabien COELHO wrote: > >>> HINT: is "foo" the right database? did you initialize first (pgbench >>> -i)? >> >> I don't think there is precedent for spitting out "HINT:" in client code >> (at least grep didn't find it). So this message might look like it's >> coming from the server, while it doesn't. > > Here is a v3, which makes it clearer that the hint comes from pgbench. > > HINT pgbench: is "foo" the right database? did you initialize first (-i)? > Hello, I've just reviewed this patch. First, I've attached a rebased version (v4), as the v3 doesn't apply anymore. The patch is pretty simple, so everything is ok. But I've noticed that if you don't specify any database to pgbench, you get an empty database information: HINT pgbench: is "" the right database? did you initialize first (-i)? This isn't related to this patch specifically, but it may be confusing for users. At least more than the other places it could already appear (debug mode and failed connection attempt). As the database name is optional, wouldn't it be better to fix this behavior? Regards. -- Julien Rouhaud http://dalibo.com - http://dalibo.org --------------000708060608020600000507 Content-Type: text/x-patch; name="pgbench-hint-4.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="pgbench-hint-4.patch" diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index 95be62c..798f035 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3241,6 +3241,7 @@ main(int argc, char **argv) if (PQresultStatus(res) !=3D PGRES_TUPLES_OK) { fprintf(stderr, "%s", PQerrorMessage(con)); + fprintf(stderr, "HINT pgbench: is \"%s\" the right database? did you i= nitialize first (-i)?\n", dbName); exit(1); } scale =3D atoi(PQgetvalue(res, 0, 0)); --------------000708060608020600000507 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --------------000708060608020600000507--