aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pgstatfuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
-rw-r--r--src/backend/utils/adt/pgstatfuncs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 44ccd37e998..688eea12a93 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -633,15 +633,13 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
{
/* Get specific pid slot */
local_beentry = pgstat_fetch_stat_local_beentry(*(int *) (funcctx->user_fctx));
- beentry = &local_beentry->backendStatus;
}
else
{
/* Get the next one in the list */
local_beentry = pgstat_fetch_stat_local_beentry(funcctx->call_cntr + 1); /* 1-based index */
- beentry = &local_beentry->backendStatus;
}
- if (!beentry)
+ if (!local_beentry)
{
int i;
@@ -655,6 +653,8 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
SRF_RETURN_NEXT(funcctx, HeapTupleGetDatum(tuple));
}
+ beentry = &local_beentry->backendStatus;
+
/* Values available to all callers */
values[0] = ObjectIdGetDatum(beentry->st_databaseid);
values[1] = Int32GetDatum(beentry->st_procpid);