Re: System username in pg_stat_activity

2024-02-20 Thread Magnus Hagander
On Fri, Feb 16, 2024 at 9:45 PM Andres Freund wrote: > > Hi, > > On 2024-02-16 15:22:16 -0500, Tom Lane wrote: > > Magnus Hagander writes: > > > I mean, we could split it into more than one view. But adding a new > > > view for every new thing we want to show is also not very good from > > >

Re: System username in pg_stat_activity

2024-02-20 Thread Magnus Hagander
On Fri, Feb 16, 2024 at 9:31 PM Magnus Hagander wrote: > > On Fri, Feb 16, 2024 at 9:20 PM Andres Freund wrote: > > > > Hi, > > > > On 2024-02-16 20:57:59 +0100, Magnus Hagander wrote: > > > On Fri, Feb 16, 2024 at 8:41 PM Andres Freund wrote: > > > > On 2024-01-10 12:46:34 +0100, Magnus

Re: System username in pg_stat_activity

2024-02-19 Thread Bertrand Drouvot
Hi, On Fri, Feb 16, 2024 at 09:41:41PM +0100, Magnus Hagander wrote: > On Fri, Feb 16, 2024 at 8:55 PM Andres Freund wrote: > > > > Hi, > > > > On 2024-01-12 17:16:53 +0100, Magnus Hagander wrote: > > > On Thu, Jan 11, 2024 at 5:55 PM Bertrand Drouvot > > > wrote: > > > > On Thu, Jan 11, 2024

Re: System username in pg_stat_activity

2024-02-19 Thread Bertrand Drouvot
Hi, On Fri, Feb 16, 2024 at 08:39:26PM +0100, Magnus Hagander wrote: > On Fri, Jan 19, 2024 at 1:43 PM Julien Rouhaud wrote: > > + value as the identity part in , or > > NULL > > I was looking at > > https://www.postgresql.org/docs/current/auth-username-maps.html and > > noticed that this

Re: System username in pg_stat_activity

2024-02-19 Thread Bertrand Drouvot
Hi, On Fri, Feb 16, 2024 at 08:17:41PM +0100, Magnus Hagander wrote: > On Fri, Jan 19, 2024 at 7:20 AM Bertrand Drouvot > wrote: > > > > Hi, > > > > On Thu, Jan 18, 2024 at 04:01:33PM +0100, Magnus Hagander wrote: > > > On Mon, Jan 15, 2024 at 11:17 AM Bertrand Drouvot > > > > Did you forget to

Re: System username in pg_stat_activity

2024-02-16 Thread Andres Freund
On 2024-02-16 21:56:25 +0100, Magnus Hagander wrote: > On Fri, Feb 16, 2024 at 9:51 PM Andres Freund wrote: > > I only skimmed the patch, but it sure looks to me that we could end up with > > none of the branches setting 31,32, so I think you'd have to make sure to > > handle that case. > > That

Re: System username in pg_stat_activity

2024-02-16 Thread Magnus Hagander
On Fri, Feb 16, 2024 at 9:51 PM Andres Freund wrote: > > Hi, > > On 2024-02-16 21:41:41 +0100, Magnus Hagander wrote: > > > Maybe I am missing something, but why aren't we just getting the value > > > from > > > the leader's entry, instead of copying it? > > > > The answer to that would be

Re: System username in pg_stat_activity

2024-02-16 Thread Andres Freund
Hi, On 2024-02-16 21:41:41 +0100, Magnus Hagander wrote: > > Maybe I am missing something, but why aren't we just getting the value from > > the leader's entry, instead of copying it? > > The answer to that would be "because I didn't think of it" :) :) > Were you thinking of something like the

Re: System username in pg_stat_activity

2024-02-16 Thread Andres Freund
Hi, On 2024-02-16 15:22:16 -0500, Tom Lane wrote: > Magnus Hagander writes: > > I mean, we could split it into more than one view. But adding a new > > view for every new thing we want to show is also not very good from > > either a usability or performance perspective. So where would we put >

Re: System username in pg_stat_activity

2024-02-16 Thread Magnus Hagander
On Fri, Feb 16, 2024 at 8:55 PM Andres Freund wrote: > > Hi, > > On 2024-01-12 17:16:53 +0100, Magnus Hagander wrote: > > On Thu, Jan 11, 2024 at 5:55 PM Bertrand Drouvot > > wrote: > > > On Thu, Jan 11, 2024 at 02:24:58PM +0100, Magnus Hagander wrote: > > > > On Wed, Jan 10, 2024 at 3:12 PM

Re: System username in pg_stat_activity

2024-02-16 Thread Magnus Hagander
On Fri, Feb 16, 2024 at 9:20 PM Andres Freund wrote: > > Hi, > > On 2024-02-16 20:57:59 +0100, Magnus Hagander wrote: > > On Fri, Feb 16, 2024 at 8:41 PM Andres Freund wrote: > > > On 2024-01-10 12:46:34 +0100, Magnus Hagander wrote: > > > > The attached patch adds a column "authuser" to

Re: System username in pg_stat_activity

2024-02-16 Thread Tom Lane
Magnus Hagander writes: > I mean, we could split it into more than one view. But adding a new > view for every new thing we want to show is also not very good from > either a usability or performance perspective. So where would we put > it? It'd have to be a new view with a row per session,

Re: System username in pg_stat_activity

2024-02-16 Thread Andres Freund
Hi, On 2024-02-16 20:57:59 +0100, Magnus Hagander wrote: > On Fri, Feb 16, 2024 at 8:41 PM Andres Freund wrote: > > On 2024-01-10 12:46:34 +0100, Magnus Hagander wrote: > > > The attached patch adds a column "authuser" to pg_stat_activity which > > > contains the username of the externally

Re: System username in pg_stat_activity

2024-02-16 Thread Magnus Hagander
On Fri, Feb 16, 2024 at 8:41 PM Andres Freund wrote: > > Hi, > > On 2024-01-10 12:46:34 +0100, Magnus Hagander wrote: > > The attached patch adds a column "authuser" to pg_stat_activity which > > contains the username of the externally authenticated user, being the > > same value as the

Re: System username in pg_stat_activity

2024-02-16 Thread Andres Freund
Hi, On 2024-01-12 17:16:53 +0100, Magnus Hagander wrote: > On Thu, Jan 11, 2024 at 5:55 PM Bertrand Drouvot > wrote: > > On Thu, Jan 11, 2024 at 02:24:58PM +0100, Magnus Hagander wrote: > > > On Wed, Jan 10, 2024 at 3:12 PM Bertrand Drouvot > > > wrote: > > > > > > > > If we go the 2 fields

Re: System username in pg_stat_activity

2024-02-16 Thread Andres Freund
Hi, On 2024-01-10 12:46:34 +0100, Magnus Hagander wrote: > The attached patch adds a column "authuser" to pg_stat_activity which > contains the username of the externally authenticated user, being the > same value as the SYSTEM_USER keyword returns in a backend. I continue to think that it's a

Re: System username in pg_stat_activity

2024-02-16 Thread Magnus Hagander
On Fri, Jan 19, 2024 at 1:43 PM Julien Rouhaud wrote: > > Hi, > > On Thu, Jan 18, 2024 at 11:01 PM Magnus Hagander wrote: > > > > I did. Here it is, and also including that suggested docs fix as well > > as a rebase on current master. > > +if (MyClientConnectionInfo.authn_id) > +

Re: System username in pg_stat_activity

2024-02-16 Thread Magnus Hagander
On Fri, Jan 19, 2024 at 12:33 PM Aleksander Alekseev wrote: > > Hi, > > > > Did you forget to share the new revision (aka v4)? I can only see the > > > "reorder_parallel_worker_bestart.patch" attached. > > > > I did. Here it is, and also including that suggested docs fix as well > > as a rebase

Re: System username in pg_stat_activity

2024-02-16 Thread Magnus Hagander
On Fri, Jan 19, 2024 at 7:20 AM Bertrand Drouvot wrote: > > Hi, > > On Thu, Jan 18, 2024 at 04:01:33PM +0100, Magnus Hagander wrote: > > On Mon, Jan 15, 2024 at 11:17 AM Bertrand Drouvot > > > Did you forget to share the new revision (aka v4)? I can only see the > > >

Re: System username in pg_stat_activity

2024-01-19 Thread Julien Rouhaud
Hi, On Thu, Jan 18, 2024 at 11:01 PM Magnus Hagander wrote: > > I did. Here it is, and also including that suggested docs fix as well > as a rebase on current master. +if (MyClientConnectionInfo.authn_id) +strlcpy(lbeentry.st_auth_identity, MyClientConnectionInfo.authn_id,

Re: System username in pg_stat_activity

2024-01-19 Thread Aleksander Alekseev
Hi, > > Did you forget to share the new revision (aka v4)? I can only see the > > "reorder_parallel_worker_bestart.patch" attached. > > I did. Here it is, and also including that suggested docs fix as well > as a rebase on current master. ``` +lbeentry.st_auth_method =

Re: System username in pg_stat_activity

2024-01-18 Thread Bertrand Drouvot
Hi, On Thu, Jan 18, 2024 at 04:01:33PM +0100, Magnus Hagander wrote: > On Mon, Jan 15, 2024 at 11:17 AM Bertrand Drouvot > > Did you forget to share the new revision (aka v4)? I can only see the > > "reorder_parallel_worker_bestart.patch" attached. > > I did. Here it is, and also including that

Re: System username in pg_stat_activity

2024-01-18 Thread Magnus Hagander
On Mon, Jan 15, 2024 at 11:17 AM Bertrand Drouvot wrote: > > Hi, > > On Fri, Jan 12, 2024 at 05:16:53PM +0100, Magnus Hagander wrote: > > On Thu, Jan 11, 2024 at 5:55 PM Bertrand Drouvot > > wrote: > > > > > > I'm wondering if it would make sense to populate it for parallel workers > > > too. >

Re: System username in pg_stat_activity

2024-01-15 Thread Bertrand Drouvot
Hi, On Fri, Jan 12, 2024 at 05:16:53PM +0100, Magnus Hagander wrote: > On Thu, Jan 11, 2024 at 5:55 PM Bertrand Drouvot > wrote: > > > > I'm wondering if it would make sense to populate it for parallel workers > > too. > > I think it's doable thanks to d951052, but I'm not sure it's worth it

Re: System username in pg_stat_activity

2024-01-12 Thread Magnus Hagander
On Thu, Jan 11, 2024 at 5:55 PM Bertrand Drouvot wrote: > > Hi, > > On Thu, Jan 11, 2024 at 02:24:58PM +0100, Magnus Hagander wrote: > > On Wed, Jan 10, 2024 at 3:12 PM Bertrand Drouvot > > wrote: > > > > > > If we go the 2 fields way, then what about auth_identity and auth_method > > > then? >

Re: System username in pg_stat_activity

2024-01-11 Thread Bertrand Drouvot
Hi, On Thu, Jan 11, 2024 at 02:24:58PM +0100, Magnus Hagander wrote: > On Wed, Jan 10, 2024 at 3:12 PM Bertrand Drouvot > wrote: > > > > If we go the 2 fields way, then what about auth_identity and auth_method > > then? > > > Here is an updated patch based on this idea. Thanks! + +

Re: System username in pg_stat_activity

2024-01-11 Thread Magnus Hagander
On Wed, Jan 10, 2024 at 3:12 PM Bertrand Drouvot wrote: > > Hi, > > On Wed, Jan 10, 2024 at 02:59:42PM +0100, Magnus Hagander wrote: > > On Wed, Jan 10, 2024 at 2:56 PM Bertrand Drouvot > > I definitely think it should be the same. If it's not exactly the > > same, then it should be *two*

Re: System username in pg_stat_activity

2024-01-10 Thread Joe Conway
On 1/10/24 08:59, Magnus Hagander wrote: On Wed, Jan 10, 2024 at 2:56 PM Bertrand Drouvot I think it depends what we want the new field to reflect. If it is the exact same thing as the SYSTEM_USER then I think it has to be text (as the SYSTEM_USER is made of "auth_method:identity"). Now if we

Re: System username in pg_stat_activity

2024-01-10 Thread Bertrand Drouvot
Hi, On Wed, Jan 10, 2024 at 02:59:42PM +0100, Magnus Hagander wrote: > On Wed, Jan 10, 2024 at 2:56 PM Bertrand Drouvot > I definitely think it should be the same. If it's not exactly the > same, then it should be *two* columns, one with auth method and one > with the name. > > And thinking more

Re: System username in pg_stat_activity

2024-01-10 Thread Magnus Hagander
On Wed, Jan 10, 2024 at 2:56 PM Bertrand Drouvot wrote: > > Hi, > > On Wed, Jan 10, 2024 at 02:08:03PM +0100, Magnus Hagander wrote: > > On Wed, Jan 10, 2024 at 1:44 PM Aleksander Alekseev > > wrote: > > > > > > Hi, > > > > > > Thanks for the patch. > > +1 > > > > > This overlaps with for

Re: System username in pg_stat_activity

2024-01-10 Thread Bertrand Drouvot
Hi, On Wed, Jan 10, 2024 at 02:08:03PM +0100, Magnus Hagander wrote: > On Wed, Jan 10, 2024 at 1:44 PM Aleksander Alekseev > wrote: > > > > Hi, > > > > Thanks for the patch. +1 > > > This overlaps with for example the values in pg_stat_gss, but it will > > > include values for authentication

Re: System username in pg_stat_activity

2024-01-10 Thread Magnus Hagander
On Wed, Jan 10, 2024 at 2:27 PM Dagfinn Ilmari Mannsåker wrote: > > Magnus Hagander writes: > > > On Wed, Jan 10, 2024 at 1:44 PM Aleksander Alekseev > > wrote: > >> > >> It hurts my sense of beauty that usename and authname are of different > >> types. But if I'm the only one, maybe we can

Re: System username in pg_stat_activity

2024-01-10 Thread Dagfinn Ilmari Mannsåker
Magnus Hagander writes: > On Wed, Jan 10, 2024 at 1:44 PM Aleksander Alekseev > wrote: >> >> It hurts my sense of beauty that usename and authname are of different >> types. But if I'm the only one, maybe we can close our eyes on this. >> Also I suspect that placing usename and authname in a

Re: System username in pg_stat_activity

2024-01-10 Thread Magnus Hagander
On Wed, Jan 10, 2024 at 1:44 PM Aleksander Alekseev wrote: > > Hi, > > Thanks for the patch. > > > The attached patch adds a column "authuser" to pg_stat_activity which > > contains the username of the externally authenticated user, being the > > same value as the SYSTEM_USER keyword returns in a

Re: System username in pg_stat_activity

2024-01-10 Thread Aleksander Alekseev
Hi, Thanks for the patch. > The attached patch adds a column "authuser" to pg_stat_activity which > contains the username of the externally authenticated user, being the > same value as the SYSTEM_USER keyword returns in a backend. I believe what was meant is "authname", not "authuser". > This

System username in pg_stat_activity

2024-01-10 Thread Magnus Hagander
The attached patch adds a column "authuser" to pg_stat_activity which contains the username of the externally authenticated user, being the same value as the SYSTEM_USER keyword returns in a backend. This overlaps with for example the values in pg_stat_gss, but it will include values for