Re: System username in pg_stat_activity - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: System username in pg_stat_activity
Date
Msg-id CAJ7c6TPAVZfP-fM-U1gg1h6NqSCg_NBSF0WmWrejJLLk_WOS+g@mail.gmail.com
Whole thread Raw
In response to Re: System username in pg_stat_activity  (Magnus Hagander <magnus@hagander.net>)
Responses Re: System username in pg_stat_activity
List pgsql-hackers
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.

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

Except for these nitpicks v4 LGTM.

-- 
Best regards,
Aleksander Alekseev



pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: [PoC] Improve dead tuple storage for lazy vacuum
Next
From: Aleksander Alekseev
Date:
Subject: Re: BUG: Former primary node might stuck when started as a standby