Re: BUG #12379: pgbench should hint to pgbench -i

From: Oleksandr Shulgin <oleksandr(dot)shulgin(at)zalando(dot)de>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: mail(at)bwe(dot)im, PostgreSQL Bugs List <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #12379: pgbench should hint to pgbench -i
Date: 2015-05-21 07:51:57
Message-ID: 87oales6zm.fsf@ashulgin01.corp.ad.zalando.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
>
>> sh> ./pgbench foo
>> ERROR: relation "pgbench_branches" does not exist
>> LINE 1: select count(*) from pgbench_branches
>> ^
>> HINT: is "foo" the right database? did you initialize first (pgbench -i)?
>
> Here is a rebase, and it uses two spaces after the colon like it seems it
> is done elsewhere.
>
> 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.

I think the following is closer to pre-existing experience, IMO:

diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 8b8b591..8d8c1fc 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -3250,6 +3250,7 @@ main(int argc, char **argv)
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "%s", PQerrorMessage(con));
+ fprintf(stderr, "Is \"%s\" the right database? Did you initialize it first (pgbench -i)?\n", dbName);
exit(1);
}
scale = atoi(PQgetvalue(res, 0, 0));

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Fabien COELHO 2015-05-21 08:10:04 Re: BUG #12379: pgbench should hint to pgbench -i
Previous Message D. S. 2015-05-21 07:35:03 unrecognized option '--help