aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorMagnus Hagander <magnus@hagander.net>2012-01-19 14:19:20 +0100
committerMagnus Hagander <magnus@hagander.net>2012-01-19 14:19:20 +0100
commit4f42b546fd87a80be30c53a0f2c897acb826ad52 (patch)
treee0831a3ac1373da87d1dd7e8c75071448e797141 /src/backend/tcop/postgres.c
parentfa352d662e57fa150158b9cb0a8f127250f8c97f (diff)
downloadpostgresql-4f42b546fd87a80be30c53a0f2c897acb826ad52.tar.gz
postgresql-4f42b546fd87a80be30c53a0f2c897acb826ad52.zip
Separate state from query string in pg_stat_activity
This separates the state (running/idle/idleintransaction etc) into it's own field ("state"), and leaves the query field containing just query text. The query text will now mean "current query" when a query is running and "last query" in other states. Accordingly,the field has been renamed from current_query to query. Since backwards compatibility was broken anyway to make that, the procpid field has also been renamed to pid - along with the same field in pg_stat_replication for consistency. Scott Mead and Magnus Hagander, review work from Greg Smith
Diffstat (limited to 'src/backend/tcop/postgres.c')
-rw-r--r--src/backend/tcop/postgres.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index 59a287f79bf..49a396918d9 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -809,7 +809,7 @@ exec_simple_query(const char *query_string)
*/
debug_query_string = query_string;
- pgstat_report_activity(query_string);
+ pgstat_report_activity(STATE_RUNNING, query_string);
TRACE_POSTGRESQL_QUERY_START(query_string);
@@ -1134,7 +1134,7 @@ exec_parse_message(const char *query_string, /* string to execute */
*/
debug_query_string = query_string;
- pgstat_report_activity(query_string);
+ pgstat_report_activity(STATE_RUNNING, query_string);
set_ps_display("PARSE", false);
@@ -1429,7 +1429,7 @@ exec_bind_message(StringInfo input_message)
*/
debug_query_string = psrc->query_string;
- pgstat_report_activity(psrc->query_string);
+ pgstat_report_activity(STATE_RUNNING, psrc->query_string);
set_ps_display("BIND", false);
@@ -1836,7 +1836,7 @@ exec_execute_message(const char *portal_name, long max_rows)
*/
debug_query_string = sourceText;
- pgstat_report_activity(sourceText);
+ pgstat_report_activity(STATE_RUNNING, sourceText);
set_ps_display(portal->commandTag, false);
@@ -3811,12 +3811,12 @@ PostgresMain(int argc, char *argv[], const char *username)
if (IsAbortedTransactionBlockState())
{
set_ps_display("idle in transaction (aborted)", false);
- pgstat_report_activity("<IDLE> in transaction (aborted)");
+ pgstat_report_activity(STATE_IDLEINTRANSACTION_ABORTED, NULL);
}
else if (IsTransactionOrTransactionBlock())
{
set_ps_display("idle in transaction", false);
- pgstat_report_activity("<IDLE> in transaction");
+ pgstat_report_activity(STATE_IDLEINTRANSACTION, NULL);
}
else
{
@@ -3824,7 +3824,7 @@ PostgresMain(int argc, char *argv[], const char *username)
pgstat_report_stat(false);
set_ps_display("idle", false);
- pgstat_report_activity("<IDLE>");
+ pgstat_report_activity(STATE_IDLE, NULL);
}
ReadyForQuery(whereToSendOutput);
@@ -3944,7 +3944,7 @@ PostgresMain(int argc, char *argv[], const char *username)
SetCurrentStatementStartTimestamp();
/* Report query to various monitoring facilities. */
- pgstat_report_activity("<FASTPATH> function call");
+ pgstat_report_activity(STATE_FASTPATH, NULL);
set_ps_display("<FASTPATH>", false);
/* start an xact for this function invocation */