Re: Add a permission check to pg_stat_get_backend_subxact()

From: shihao zhong <zhong950419(at)gmail(dot)com>
To: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add a permission check to pg_stat_get_backend_subxact()
Date: 2026-09-23 03:22:40
Message-ID: CAGRkXqTLuE3PrRn7tXJ8t+7UHcTUJ9cuaFxbZkuhpAySD0RpfA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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?

Done in v8, attached.

0001 is the PID check, same as v7-0002. It goes first now because 0002
needs a field in PgStat_Backend.

0002 stores the user ID in PgStat_Backend next to the PID when the entry
is created, and pg_stat_get_backend_io(), wal() and lock() check the
caller against that instead of the beentry. The reset callback restores
both fields. pg_stat_get_backend_subxact() still checks the beentry, the
counters it reports come from there.

Thanks,
Shihao

Attachment Content-Type Size
v8-0002-Make-per-backend-statistics-functions-respect-sta.patch application/octet-stream 15.8 KB
v8-0001-Store-the-PID-of-a-backend-in-its-statistics-entr.patch application/octet-stream 3.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-09-23 04:19:58 Re: Adding a range check on the sequence index from the publisher.
Previous Message jian he 2026-09-23 03:02:33 stale comment in struct AlteredTableInfo