#include "common/username.h"
#include "fe_utils/cancel.h"
#include "fe_utils/conditional.h"
+#include "fe_utils/string_utils.h"
#include "getopt_long.h"
#include "libpq-fe.h"
#include "pgbench.h"
}
}
+/* print version banner */
+static void
+printVersion(PGconn *con)
+{
+ int server_ver = PQserverVersion(con);
+ int client_ver = PG_VERSION_NUM;
+
+ if (server_ver != client_ver)
+ {
+ const char *server_version;
+ char sverbuf[32];
+
+ /* Try to get full text form, might include "devel" etc */
+ server_version = PQparameterStatus(con, "server_version");
+ /* Otherwise fall back on server_ver */
+ if (!server_version)
+ {
+ formatPGVersionNumber(server_ver, true,
+ sverbuf, sizeof(sverbuf));
+ server_version = sverbuf;
+ }
+
+ printf(_("%s (%s, server %s)\n"),
+ "pgbench", PG_VERSION, server_version);
+ }
+ /* For version match, only print pgbench version */
+ else
+ printf("%s (%s)\n", "pgbench", PG_VERSION);
+ fflush(stdout);
+}
+
/* print out results */
static void
printResults(StatsData *total,
double bench_duration = PG_TIME_GET_DOUBLE(total_duration);
double tps = ntx / bench_duration;
- printf("pgbench (PostgreSQL) %d.%d\n", PG_VERSION_NUM / 10000, PG_VERSION_NUM % 100);
/* Report test parameters. */
printf("transaction type: %s\n",
num_scripts == 1 ? sql_script[0].desc : "multiple scripts");
if (con == NULL)
exit(1);
+ /* report pgbench and server versions */
+ printVersion(con);
+
pg_log_debug("pghost: %s pgport: %s nclients: %d %s: %d dbName: %s",
PQhost(con), PQport(con), nclients,
duration <= 0 ? "nxacts" : "duration",