| From: | shihao zhong <zhong950419(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(at)paquier(dot)xyz> |
| Cc: | 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-12 12:43:28 |
| Message-ID: | CAGRkXqRGVNvvkY7a7X=3Bn=WgfLuFZ5iVsBf+t6HSfm2RwVC+g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Jim, Michael,
> Shihao, feel free to modify or reject these changes (it's your patch)
Thanks Jim, grouping the four functions is the right thing. v4 attached,
with three small changes to 0002:
> Applied this one for now.
Thanks for committing that, I will not include 0001 in the following emails.
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.
Thanks,
Shihao
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0002-Make-per-backend-statistics-functions-respect-sta.patch | application/octet-stream | 15.4 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shihao zhong | 2026-09-12 12:51:57 | Re: REPACK (CONCURRENTLY) decoding worker is canceled by lock_timeout |
| Previous Message | Andrei Lepikhov | 2026-09-12 12:02:23 | Re: Do not scan index in right table if condition for left join evaluates to false using columns in left table |