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 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 ));
You can’t perform that action at this time.
0 commit comments