File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 55
55
56
56
#include "pgbench.h"
57
57
58
+ #define ERRCODE_UNDEFINED_TABLE "42P01"
59
+
58
60
/*
59
61
* Multi-platform pthread implementations
60
62
*/
@@ -3252,7 +3254,14 @@ main(int argc, char **argv)
3252
3254
res = PQexec (con , "select count(*) from pgbench_branches" );
3253
3255
if (PQresultStatus (res ) != PGRES_TUPLES_OK )
3254
3256
{
3257
+ char * sqlState = PQresultErrorField (res , PG_DIAG_SQLSTATE );
3258
+
3255
3259
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
+
3256
3265
exit (1 );
3257
3266
}
3258
3267
scale = atoi (PQgetvalue (res , 0 , 0 ));
You can’t perform that action at this time.
0 commit comments