pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: shihao zhong <zhong950419@gmail.com>
Cc: Jim Jones <jim.jones@uni-muenster.de>
Cc: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Cc: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Subject: Re: Add a permission check to pg_stat_get_backend_subxact()
Date: Mon, 14 Sep 2026 16:06:04 +0900
Message-ID: <aqec3MF_GDsMdadl@paquier.xyz> (raw)
In-Reply-To: <CAGRkXqRGVNvvkY7a7X=3Bn=WgfLuFZ5iVsBf+t6HSfm2RwVC+g@mail.gmail.com>
References: <CAGRkXqTBZ+zbVuDC8xGEB6Btj61hsui5H5nGqzFBDyOXc=4bjQ@mail.gmail.com>
	<ef48668c-cf8e-4f4b-bf39-4b3b9fb9b85a@uni-muenster.de>
	<aqOzYr0It5sP7eFF@paquier.xyz>
	<c7a0be5d-5328-41dd-a7bf-6b964e9f7a06@uni-muenster.de>
	<aqSXMjhwFFzz_zyo@paquier.xyz>
	<CAGRkXqRGVNvvkY7a7X=3Bn=WgfLuFZ5iVsBf+t6HSfm2RwVC+g@mail.gmail.com>

On Sat, Sep 12, 2026 at 08:43:28AM -0400, shihao zhong wrote:
> Thanks for committing that, I will not include 0001 in the following emails.

Fixed the subxact_overflow -> subxact_overflowed, as that's
independent.

> 1. The first test block ran as superuser, so the owner branch of
>   HAS_PGSTAT_PERMISSIONS() was never exercised: with "userid" forced to
>   InvalidOid the test still passed.  The block now grants the test role
>   membership in the session's role instead.  With that, forcing userid
>   to InvalidOid fails the test, and removing the checks fails the
>   "unrelated role" block.
> 
> 2. The doc paragraph above the per-backend table said the functions
>   "return NULL", but activity/wait_event return "<insufficient
>   privilege>" and the SRFs return no rows.  Reworded.
> 
> 3. Commit message: noted that processes owned by no role (autovacuum
>   workers, WAL writer, ...) are now visible only to superusers and
>   pg_read_all_stats, as in pg_stat_activity, and that no backpatch is
>   done.

That seems globally sensible, at quick glance.  I am also adding
Bertrand Drouvot in CC to comment about this change, as he has worked
on three of these functions.

@Bertrand, what do you think?
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../aqec3MF_GDsMdadl@paquier.xyz/2-signature.asc)
  download

view thread (27+ messages)  latest in thread

Message-ID: <aqec3MF_GDsMdadl@paquier.xyz>
Permalink:  ../aqec3MF_GDsMdadl@paquier.xyz/
Also on:    postgresql.org/message-id/aqec3MF_GDsMdadl@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: michael@paquier.xyz, zhong950419@gmail.com, jim.jones@uni-muenster.de, pgsql-hackers@lists.postgresql.org, bertranddrouvot.pg@gmail.com
  Subject: Re: Add a permission check to pg_stat_get_backend_subxact()
  In-Reply-To: <aqec3MF_GDsMdadl@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox