Commit 1ecd035b authored by Jan Wieck's avatar Jan Wieck

Added hints about the reason, why the command string in

the view pg_stat_activity is missing, as per Bruces suggestion.

Jan
parent c3c09be3
...@@ -286,20 +286,24 @@ pg_stat_get_backend_activity(PG_FUNCTION_ARGS) ...@@ -286,20 +286,24 @@ pg_stat_get_backend_activity(PG_FUNCTION_ARGS)
PgStat_StatBeEntry *beentry; PgStat_StatBeEntry *beentry;
int32 beid; int32 beid;
int len; int len;
char *activity;
text *result; text *result;
beid = PG_GETARG_INT32(0); beid = PG_GETARG_INT32(0);
if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL) if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
PG_RETURN_NULL(); activity = "<backend information not available>";
else if (!superuser() && beentry->userid != GetUserId())
if (!superuser() && beentry->userid != GetUserId()) activity = "<insufficient privilege>";
PG_RETURN_NULL(); else if (*(beentry->activity) == '\0')
activity = "<command string not enabled>";
else
activity = beentry->activity;
len = strlen(beentry->activity); len = strlen(activity);
result = palloc(VARHDRSZ + len); result = palloc(VARHDRSZ + len);
VARATT_SIZEP(result) = VARHDRSZ + len; VARATT_SIZEP(result) = VARHDRSZ + len;
memcpy(VARDATA(result), beentry->activity, len); memcpy(VARDATA(result), activity, len);
PG_RETURN_TEXT_P(result); PG_RETURN_TEXT_P(result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment