Re: Add a permission check to pg_stat_get_backend_subxact() - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Add a permission check to pg_stat_get_backend_subxact()
Date
Msg-id arKKltvf8PpIByOF@bdtpg
Whole thread
In response to Re: Add a permission check to pg_stat_get_backend_subxact()  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Add a permission check to pg_stat_get_backend_subxact()
List pgsql-hackers
Hi,

On Tue, Sep 22, 2026 at 08:23:54PM +0900, Michael Paquier wrote:
> On Tue, Sep 22, 2026 at 10:03:10AM +0000, Bertrand Drouvot wrote:
> > I'm not sure the user ID alone is enough though: if B reuses A's ProcNumber,
> > pg_stat_get_backend_wal(B_pid) could still return A's cached statistics when
> > the caller is allowed to see A's data. 
> > 
> > I'd keep the PID check from 0002 as well. A generation would be more robust
> > against PID reuse, as done for example for AIO handles, but introducing a
> > backend generation seems like too much for this case.
> > 
> > So storing both seems like the simplest approach: the user ID for the ACL
> > check and the PID for matching the statistics to the requested backend.
> 
> The PID would also act as a kind of weaker generation number, slightly
> weaker but simpler.  So that works here.  Perhaps you would like to
> give it a shot?

Do you mean adding the user ID on top of Shihao's 0002? If so, I can have a look,
unless Shihao is already planning to update the patch along those lines?

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring
Next
From: Tom Lane
Date:
Subject: Re: run pgindent in CI