mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Add hint to run "pgbench -i", if test tables don't exist.
Fabien Coelho, reviewed by Julien Rouhaud
This commit is contained in:
parent
6e5d9f278c
commit
e7b90c52b3
@ -55,6 +55,8 @@
|
|||||||
|
|
||||||
#include "pgbench.h"
|
#include "pgbench.h"
|
||||||
|
|
||||||
|
#define ERRCODE_UNDEFINED_TABLE "42P01"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Multi-platform pthread implementations
|
* Multi-platform pthread implementations
|
||||||
*/
|
*/
|
||||||
@ -3252,7 +3254,14 @@ main(int argc, char **argv)
|
|||||||
res = PQexec(con, "select count(*) from pgbench_branches");
|
res = PQexec(con, "select count(*) from pgbench_branches");
|
||||||
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
if (PQresultStatus(res) != PGRES_TUPLES_OK)
|
||||||
{
|
{
|
||||||
|
char *sqlState = PQresultErrorField(res, PG_DIAG_SQLSTATE);
|
||||||
|
|
||||||
fprintf(stderr, "%s", PQerrorMessage(con));
|
fprintf(stderr, "%s", PQerrorMessage(con));
|
||||||
|
if (sqlState && strcmp(sqlState, ERRCODE_UNDEFINED_TABLE) == 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Perhaps you need to do initialization (\"pgbench -i\") in database \"%s\"\n", PQdb(con));
|
||||||
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
scale = atoi(PQgetvalue(res, 0, 0));
|
scale = atoi(PQgetvalue(res, 0, 0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user