On 27.02.25 14:54, Greg Sabino Mullane wrote:
> Great question. I think "supposed to" is a bit of a stretch, but I
> presume it's the difference between a client connecting and using its
> connection information versus an already existing backend process,
> which is always going to be "local".
>
> Overall this makes sense, as that checkpoint example above is coming
> from the checkpointer background process at 3114981, not the backend
> process that happened to trigger it. And 3114981 has no way of knowing
> the details of the caller's connection.
>
In that case, it LGTM.
I revisited this patch and tested it with two different computers (for
client and server).
Initially, I was momentarily confused by the logged address format,
which varies depending on the client's format. However, I found that %h
behaves just like this, so I guess it is ok.
postgres=# SHOW log_line_prefix;
log_line_prefix
-----------------------
%m [%p]: L=%L, h=%h
(1 row)
2025-03-02 18:19:07.859 CET [2246150]: L=192.168.178.27,
h=192.168.178.79 ERROR: division by zero
2025-03-02 18:19:07.859 CET [2246150]: L=192.168.178.27,
h=192.168.178.79 STATEMENT: SELECT 1/0
2025-03-02 18:19:19.327 CET [2246291]: L=2a02:...:7591, h=2a02:...:4a7
ERROR: division by zero
2025-03-02 18:19:19.327 CET [2246291]: L=2a02:...:7591, h=2a02:...:4a7
STATEMENT: SELECT 1/0
Best, Jim