1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-13 07:41:39 +03:00

Code review for pg_stat_get_backend_activity_start patch --- fix

return type, make protection condition agree with recent change to
pg_stat_get_backend_activity, clean up documentation.
This commit is contained in:
Tom Lane
2003-04-04 03:03:54 +00:00
parent a385186ff7
commit 3b4ca4c0d9
5 changed files with 22 additions and 21 deletions

View File

@ -308,14 +308,14 @@ pg_stat_get_backend_activity_start(PG_FUNCTION_ARGS)
int32 beid;
AbsoluteTime sec;
int usec;
Timestamp result;
TimestampTz result;
beid = PG_GETARG_INT32(0);
if (!superuser())
if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
PG_RETURN_NULL();
if ((beentry = pgstat_fetch_stat_beentry(beid)) == NULL)
if (!superuser() && beentry->userid != GetUserId())
PG_RETURN_NULL();
sec = beentry->activity_start_sec;
@ -341,7 +341,7 @@ pg_stat_get_backend_activity_start(PG_FUNCTION_ARGS)
date2j(1970, 1, 1)) * 86400));
#endif
PG_RETURN_TIMESTAMP(result);
PG_RETURN_TIMESTAMPTZ(result);
}