Re: Use HostsFileName everywhere

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: surya poondla <suryapoondla4(at)gmail(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: Use HostsFileName everywhere
Date: 2026-07-07 06:36:09
Message-ID: akyeWXx4Cof7l7iw@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 06, 2026 at 04:43:53PM -0700, surya poondla wrote:
> Hi Zsolt,
> Thanks for reporting the bug and the patch. If an operator changes the
> hosts_file GUC, without the patch those three messages don't get updated
> and it makes debugging a lot harder. The fix is clearly right.

Looks like an oversight of 4f433025f666. This is not critical, still
a nice life improvement if setting a custom file value for these error
messages.

> A couple of observations:
> 1. Small typo in the commit message "harcoded" → "hardcoded".
> 2. While reviewing I noticed a related NULL-safety question. This isn't
> caused by your patch, I was just digging to see whether it could turn into
> a crash or segfault after the change.

SetConfigOption() is called for hosts_file at an early startup stage,
as of SelectConfigFiles(). init_host_context() and be_tls_init()
require the GUCs to be loaded, meaning that a NULL value would not be
an issue because it will be either the default of pg_hosts.conf or the
custom value set in postgresql.conf. HBA and ident files work the
same way: we need them loaded before any authentication would kick in,
including direct SSL requests.

In short, I think that the patch should be OK. Purely cosmetic, still
OK. Daniel?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2026-07-07 06:36:48 Re: Support EXCEPT for ALL SEQUENCES publications
Previous Message Bharath Rupireddy 2026-07-07 06:34:06 Re: Introduce XID age based replication slot invalidation