summaryrefslogtreecommitdiffstats
path: root/commands.c
diff options
context:
space:
mode:
authorMark Wong <mark@2ndQuadrant.com>2015-11-09 13:44:38 -0800
committerMark Wong <mark@2ndQuadrant.com>2015-11-09 13:44:38 -0800
commitf5dc63afd881da6f239d402f1f06bf3c3e0c53c1 (patch)
treeea089731eed584cb2d8e31eaf02b62b5133521d9 /commands.c
parent411cb9951565832db3f5b03677bf7d43a44f170f (diff)
Allow sorting of pg_stat_statements view
Diffstat (limited to 'commands.c')
-rw-r--r--commands.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/commands.c b/commands.c
index c95ecee..a7ed04f 100644
--- a/commands.c
+++ b/commands.c
@@ -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)