Re: System username in pg_stat_activity

From: Joe Conway <mail(at)joeconway(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: System username in pg_stat_activity
Date: 2024-01-10 14:17:13
Message-ID: 671e76bf-4a81-4da7-a208-efb6ce81d3b4@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 want it to be "only" the identity
>> part of it, then the `name` datatype would be fine. I'd vote for the exact same
>> thing as the SYSTEM_USER (means auth_method:identity).
>
> 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 about it maybe that's cleaner, because that makes it
> easier to do things like filter based on auth method?

+1 for the overall feature and +1 for two columns

>> > + <row>
>> > + <entry role="catalog_table_entry"><para role="column_definition">
>> > + <structfield>authname</structfield> <type>name</type>
>> > + </para>
>> > + <para>
>> > + The authentication method and identity (if any) that the user
>> > + used to log in. It contains the same value as
>> > + <xref linkend="system-user" /> returns in the backend.
>> > + </para></entry>
>> > + </row>
>>
>> I'm fine with auth_method:identity.
>>
>> > + S.authname,
>>
>> What about using system_user as the field name? (because if we keep
>> auth_method:identity it's not really the authname anyway).
>
> I was worried system_user or sysuser would both be confusing with the
> fact that we have usesysid -- which would reference a *different*
> sys...

I think if it is exactly "system_user" it would be pretty clearly a
match for SYSTEM_USER

--
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-01-10 14:18:00 Re: [PATCH] Add sortsupport for range types and btree_gist
Previous Message Bertrand Drouvot 2024-01-10 14:12:28 Re: System username in pg_stat_activity