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

From shihao zhong
Subject Re: Add a permission check to pg_stat_get_backend_subxact()
Date
Msg-id CAGRkXqQsOsB2_M73Y-cgQyzyXVx59qra-xFUo2-zQOTiNMSV8w@mail.gmail.com
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 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

pgsql-hackers by date:

Previous
From: shihao zhong
Date:
Subject: Re: REPACK (CONCURRENTLY) can silently lose updates when the toast table is rewritten
Next
From: Chao Li
Date:
Subject: Re: Reset waitStart when a lock wait fails