Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ecd035

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
Added hints about the reason, why the command string in
the view pg_stat_activity is missing, as per Bruces suggestion.Jan
1 parentc3c09be commit1ecd035

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎src/backend/utils/adt/pgstatfuncs.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,20 +286,24 @@ pg_stat_get_backend_activity(PG_FUNCTION_ARGS)
286286
PgStat_StatBeEntry*beentry;
287287
int32beid;
288288
intlen;
289+
char*activity;
289290
text*result;
290291

291292
beid=PG_GETARG_INT32(0);
292293

293294
if ((beentry=pgstat_fetch_stat_beentry(beid))==NULL)
294-
PG_RETURN_NULL();
295-
296-
if (!superuser()&&beentry->userid!=GetUserId())
297-
PG_RETURN_NULL();
295+
activity="<backend information not available>";
296+
elseif (!superuser()&&beentry->userid!=GetUserId())
297+
activity="<insufficient privilege>";
298+
elseif (*(beentry->activity)=='\0')
299+
activity="<command string not enabled>";
300+
else
301+
activity=beentry->activity;
298302

299-
len=strlen(beentry->activity);
303+
len=strlen(activity);
300304
result=palloc(VARHDRSZ+len);
301305
VARATT_SIZEP(result)=VARHDRSZ+len;
302-
memcpy(VARDATA(result),beentry->activity,len);
306+
memcpy(VARDATA(result),activity,len);
303307

304308
PG_RETURN_TEXT_P(result);
305309
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp