diff options
author | Mark Wong <mark@2ndQuadrant.com> | 2015-11-09 13:44:38 -0800 |
---|---|---|
committer | Mark Wong <mark@2ndQuadrant.com> | 2015-11-09 13:44:38 -0800 |
commit | f5dc63afd881da6f239d402f1f06bf3c3e0c53c1 (patch) | |
tree | ea089731eed584cb2d8e31eaf02b62b5133521d9 /commands.c | |
parent | 411cb9951565832db3f5b03677bf7d43a44f170f (diff) |
Allow sorting of pg_stat_statements view
Diffstat (limited to 'commands.c')
-rw-r--r-- | commands.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -494,7 +494,8 @@ cmd_order(struct pg_top_context *pgtctx) new_message(MT_standout, "Order to sort: "); if (readline(tempbuf, sizeof(tempbuf), No) > 0) { - if ((i = string_index(tempbuf, pgtctx->statics.order_names_io)) == -1) + if ((i = string_index(tempbuf, + pgtctx->statics.order_names_io)) == -1) { new_message(MT_standout, " %s: unrecognized sorting order", tempbuf); @@ -510,6 +511,26 @@ cmd_order(struct pg_top_context *pgtctx) clear_message(); } break; + case MODE_STATEMENTS: + new_message(MT_standout, "Order to sort: "); + if (readline(tempbuf, sizeof(tempbuf), No) > 0) + { + if ((i = string_index(tempbuf, statement_ordernames)) == -1) + { + new_message(MT_standout, " %s: unrecognized sorting order", + tempbuf); + no_command = Yes; + } + else + { + pgtctx->statement_order_index = i; + } + } + else + { + clear_message(); + } + break; case MODE_PROCESSES: default: if (pgtctx->statics.order_names == NULL) |