Fix a typo in pgstatfuncs.c

Started by Drouvot, Bertrandover 3 years ago3 messages
#1Drouvot, Bertrand
bdrouvot@amazon.com
1 attachment(s)

Hi,

It seems like there's the following typo in pgstatfuncs.c:

-               /* Values only available to role member or 
pg_read_all_stats */
+               /* Values only available to role member of 
pg_read_all_stats */

Attaching a tiny patch to fix it.

Regards,

--
Bertrand Drouvot
Amazon Web Services: https://aws.amazon.com

Attachments:

v1-0001-fix-a-typo-in-pgstatfuncs.c.patchtext/plain; charset=UTF-8; name=v1-0001-fix-a-typo-in-pgstatfuncs.c.patchDownload
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index d9e2a79382..f78d5eb085 100644
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -610,7 +610,7 @@ pg_stat_get_activity(PG_FUNCTION_ARGS)
 		else
 			nulls[16] = true;
 
-		/* Values only available to role member or pg_read_all_stats */
+		/* Values only available to role member of pg_read_all_stats */
 		if (HAS_PGSTAT_PERMISSIONS(beentry->st_userid))
 		{
 			SockAddr	zero_clientaddr;
#2Bharath Rupireddy
bharath.rupireddyforpostgres@gmail.com
In reply to: Drouvot, Bertrand (#1)
Re: Fix a typo in pgstatfuncs.c

On Wed, Aug 10, 2022 at 1:22 PM Drouvot, Bertrand <bdrouvot@amazon.com> wrote:

Hi,

It seems like there's the following typo in pgstatfuncs.c:

-               /* Values only available to role member or
pg_read_all_stats */
+               /* Values only available to role member of
pg_read_all_stats */

Attaching a tiny patch to fix it.

I don't think it's a typo, the comment says that the values are only
available to the user who has privileges of backend's role or
pg_read_all_stats, the macro HAS_PGSTAT_PERMISSIONS says it all.

IMO, any of the following works better, if the existing comment is confusing:

/* Values only available to the member{or role or user} with
privileges of backend's role or pg_read_all_stats */

/* Values only available to the member{or role or user} that
has membership in backend's role or has privileges of
pg_read_all_stats */

--
Bharath Rupireddy
RDS Open Source Databases: https://aws.amazon.com/rds/postgresql/

#3Drouvot, Bertrand
bdrouvot@amazon.com
In reply to: Bharath Rupireddy (#2)
Re: Fix a typo in pgstatfuncs.c

Hi,

On 8/10/22 10:30 AM, Bharath Rupireddy wrote:

On Wed, Aug 10, 2022 at 1:22 PM Drouvot, Bertrand <bdrouvot@amazon.com> wrote:

Hi,

It seems like there's the following typo in pgstatfuncs.c:

-               /* Values only available to role member or
pg_read_all_stats */
+               /* Values only available to role member of
pg_read_all_stats */

Attaching a tiny patch to fix it.

I don't think it's a typo, the comment says that the values are only
available to the user who has privileges of backend's role or
pg_read_all_stats, the macro HAS_PGSTAT_PERMISSIONS says it all.

Looking at HAS_PGSTAT_PERMISSIONS, i think you are right: sorry for the
noise.

Thanks!

Bertrand Drouvot
Amazon Web Services: https://aws.amazon.com