Re: Log connection establishment timings - Mailing list pgsql-hackers

From Bertrand Drouvot
Subject Re: Log connection establishment timings
Date
Msg-id Z8W3kClxw3dxHdAa@ip-10-97-1-34.eu-west-3.compute.internal
Whole thread Raw
In response to Re: Log connection establishment timings  (Melanie Plageman <melanieplageman@gmail.com>)
List pgsql-hackers
Hi,

On Fri, Feb 28, 2025 at 05:42:37PM -0500, Melanie Plageman wrote:
> And all of these places we have to be super
> careful that the GUCs have already been read before using
> log_connections, so it seems a bit unsafe to check log_connections
> (the global variable) in a function.

Yeah, that could be checking before calling the function (the caller would be
responsible for checking log_connections)

> Also, I also wasn't sure if it would be weird to call a function like
> "LogConnectionTiming()" which in many cases doesn't log the connection
> timing (because it is a different backend type).
> 
> But maybe I'm not thinking about it correctly. What were you imagining?

I did not imagine that much ;-) I was just seeing this code being duplicated
and just thought about to avoid the duplication. But now that I read your comments
above then I think we could just macro-ize the child_type check (as you mentioned
up-thread). That would avoid the risk to forget to update the 3 locations doing the
exact same check should we add a new child type in the game.

Regards,

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



pgsql-hackers by date:

Previous
From: Israel Barth Rubio
Date:
Subject: Re: Add -k/--link option to pg_combinebackup
Next
From: Matthias van de Meent
Date:
Subject: Re: making EXPLAIN extensible