Re: System username in pg_stat_activity

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Aleksander Alekseev <aleksander(at)timescale(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Subject: Re: System username in pg_stat_activity
Date: 2024-02-16 19:23:22
Message-ID: CABUevEyRmkeA1vGmEvPBJM22pHdBL3kAxKm-T7Rg9kKBg6vt=g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 19, 2024 at 12:33 PM Aleksander Alekseev
<aleksander(at)timescale(dot)com> 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 on current master.
>
> ```
> + lbeentry.st_auth_method = MyClientConnectionInfo.auth_method;
> + if (MyClientConnectionInfo.authn_id)
> + strlcpy(lbeentry.st_auth_identity,
> MyClientConnectionInfo.authn_id, NAMEDATALEN);
> + else
> + MemSet(&lbeentry.st_auth_identity, 0,
> sizeof(lbeentry.st_auth_identity));
> ```
>
> I believe using sizeof(lbeentry.st_auth_identity) instead of
> NAMEDATALEN is generally considered a better practice.

We use the NAMEDATALEN method in the rest of the function, so I did it
the same way for consistency. I think if we want to change that, we
should change the whole function at once to keep it consistent.

> Calling MemSet for a CString seems to be an overkill. I suggest
> setting lbeentry.st_auth_identity[0] to zero.

Fair enough. Will make that change.

//Magnus

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-02-16 19:38:50 Re: Improving EXPLAIN's display of SubPlan nodes
Previous Message Andres Freund 2024-02-16 19:23:01 Re: SQL Property Graph Queries (SQL/PGQ)