"cluster show": fix formatting with multiple digit node IDs

This commit is contained in:
Ian Barwick
2019-02-02 14:04:30 +09:00
parent f24b30327c
commit 59ed86c01a
3 changed files with 15 additions and 1 deletions

View File

@@ -137,6 +137,7 @@ do_cluster_show(void)
for (cell = nodes.head; cell; cell = cell->next)
{
PQExpBufferData details;
PQExpBufferData node_id;
cell->node_info->conn = establish_db_connection_quiet(cell->node_info->conninfo);
@@ -352,6 +353,11 @@ do_cluster_show(void)
PQfinish(cell->node_info->conn);
cell->node_info->conn = NULL;
initPQExpBuffer(&node_id);
appendPQExpBuffer(&node_id, "%i", cell->node_info->node_id);
headers_show[SHOW_ID].cur_length = strlen(node_id.data);
termPQExpBuffer(&node_id);
headers_show[SHOW_ROLE].cur_length = strlen(get_node_type_string(cell->node_info->type));
headers_show[SHOW_NAME].cur_length = strlen(cell->node_info->node_name);
headers_show[SHOW_STATUS].cur_length = strlen(cell->node_info->details);