Re: BUG #12379: pgbench should hint to pgbench -i - Mailing list pgsql-bugs

From Oleksandr Shulgin
Subject Re: BUG #12379: pgbench should hint to pgbench -i
Date
Msg-id 87oales6zm.fsf@ashulgin01.corp.ad.zalando.net
Whole thread Raw
In response to Re: BUG #12379: pgbench should hint to pgbench -i  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: BUG #12379: pgbench should hint to pgbench -i
Re: BUG #12379: pgbench should hint to pgbench -i
List pgsql-bugs
Fabien COELHO <coelho@cri.ensmp.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));

pgsql-bugs by date:

Previous
From: Oleksandr Shulgin
Date:
Subject: Re: PQexec() hangs on OOM
Next
From: Fabien COELHO
Date:
Subject: Re: BUG #12379: pgbench should hint to pgbench -i