From 8408e3a5511943cdf8f3f839dc674afb139a1ae7 Mon Sep 17 00:00:00 2001 From: Jaime Casanova Date: Thu, 30 Sep 2010 19:43:13 -0500 Subject: [PATCH] A few fixes product of Cedric Villemain's review --- repmgr.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/repmgr.c b/repmgr.c index 93d3fdaf..e5638950 100644 --- a/repmgr.c +++ b/repmgr.c @@ -551,7 +551,9 @@ do_standby_promote(void) fprintf(stderr, _("Ignoring dest-dir option because it has no meaning while promoting")); /* Connection parameters for standby. always use localhost for standby */ + keywords[0] = "host"; values[0] = "localhost"; + keywords[1] = "port"; values[1] = standbyport; /* We need to connect to check configuration */ @@ -563,6 +565,13 @@ do_standby_promote(void) return; } + if (!is_supported_version(conn)) + { + PQfinish(conn); + fprintf(stderr, _("%s needs PostgreSQL 9.0 or better\n"), progname); + return; + } + /* Check we are in a standby node */ if (!is_standby(conn)) { @@ -619,7 +628,9 @@ do_standby_follow(void) char data_dir[MAXLEN]; /* Connection parameters for master */ + keywords[0] = "host"; values[0] = host; + keywords[1] = "port"; values[1] = masterport; conn = PQconnectdbParams(keywords, values, true);