| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, 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-24 01:51:55 |
| Message-ID: | CAGRkXqQsOsB2_M73Y-cgQyzyXVx59qra-xFUo2-zQOTiNMSV8w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Michael,
> In terms of implementation simplicity, I see more merit with the existing
> logic where we don't add a PID tracking because it's well, simpler!
OK, v10 drops the PID from the stats entry. v10-0001 is the permission
patch, and the entry stores only the role of the backend. That is enough
for the snapshot case upthread. The old entry keeps the role of the old
backend, so u1 gets nothing from it. I checked it with the same script.
> The role ID case is different: we want consistency to check for the
> permissions.
v10-0002 is optional and follows that idea for Bertrand's point on
pg_stat_get_backend_subxact(). The role is checked from the copied status
entry, but the subxact counters are read from PGPROC in a second step.
The PID check makes sure both come from the same backend. Your call.
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| v10-0002-Check-the-PID-when-reading-the-transaction-statu.patch | application/octet-stream | 3.5 KB |
| v10-0001-Make-per-backend-statistics-functions-respect-st.patch | application/octet-stream | 15.7 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2026-09-24 02:37:12 | Re: Reset waitStart when a lock wait fails |
| Previous Message | shihao zhong | 2026-09-24 01:45:34 | Re: REPACK (CONCURRENTLY) can silently lose updates when the toast table is rewritten |