diff --git a/repmgr.c b/repmgr.c index 0925cd5c..89f7331c 100644 --- a/repmgr.c +++ b/repmgr.c @@ -679,9 +679,13 @@ do_cluster_show(void) conn = establish_db_connection(options.conninfo, true); sqlquery_snprintf(sqlquery, - "SELECT conninfo, type " - " FROM %s.repl_nodes ", - get_repmgr_schema_quoted(conn)); + "SELECT rn.conninfo, rn.type, rn.name, sq.name" + " FROM %s.repl_nodes as rn" + " LEFT JOIN %s.repl_nodes AS sq" + " ON sq.id=rn.upstream_node_id", + get_repmgr_schema_quoted(conn), + get_repmgr_schema_quoted(conn)); + res = PQexec(conn, sqlquery); if (PQresultStatus(res) != PGRES_TUPLES_OK) @@ -696,7 +700,7 @@ do_cluster_show(void) } PQfinish(conn); - printf("Role | Connection String\n"); + printf("Role | Name | Upstream | Connection String\n"); for (i = 0; i < PQntuples(res); i++) { conn = establish_db_connection(PQgetvalue(res, i, 0), false); @@ -710,6 +714,8 @@ do_cluster_show(void) strcpy(node_role, "* master"); printf("%-10s", node_role); + printf("| %-14s", PQgetvalue(res, i, 2)); + printf("| %-14s", PQgetvalue(res, i, 3)); printf("| %s\n", PQgetvalue(res, i, 0)); PQfinish(conn);