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));