Skip to content

Commit e7b90c5

Browse files
committed
Add hint to run "pgbench -i", if test tables don't exist.
Fabien Coelho, reviewed by Julien Rouhaud
1 parent 6e5d9f2 commit e7b90c5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/bin/pgbench/pgbench.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555

5656
#include "pgbench.h"
5757

58+
#define ERRCODE_UNDEFINED_TABLE "42P01"
59+
5860
/*
5961
* Multi-platform pthread implementations
6062
*/
@@ -3252,7 +3254,14 @@ main(int argc, char **argv)
32523254
res = PQexec(con, "select count(*) from pgbench_branches");
32533255
if (PQresultStatus(res) != PGRES_TUPLES_OK)
32543256
{
3257+
char *sqlState = PQresultErrorField(res, PG_DIAG_SQLSTATE);
3258+
32553259
fprintf(stderr, "%s", PQerrorMessage(con));
3260+
if (sqlState && strcmp(sqlState, ERRCODE_UNDEFINED_TABLE) == 0)
3261+
{
3262+
fprintf(stderr, "Perhaps you need to do initialization (\"pgbench -i\") in database \"%s\"\n", PQdb(con));
3263+
}
3264+
32563265
exit(1);
32573266
}
32583267
scale = atoi(PQgetvalue(res, 0, 0));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy