pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Subject: @remove-line-for-nolocal@ is dead code
Date: Wed, 18 Feb 2026 18:42:37 -0500
Message-ID: <2287786.1771458157@sss.pgh.pa.us> (raw)

While poking at something else, I noticed that the logic in initdb
about removing "@remove-line-for-nolocal@" from pg_hba.conf is
useless.  Since commit f55808828, it's applied unconditionally;
so we might as well just edit that out of pg_hba.conf.sample and
delete the code to do so during initdb.

This won't save any interesting number of cycles of course, but
I think it's confusing to have that decoration in pg_hba.conf.sample
when it doesn't do anything.

Any objection to the attached?

			regards, tom lane

Attachments:

0001-remove-dead-code-for-nolocal.patch (text/x-diff, 1.7K) download diff --git a/src/backend/libpq/pg_hba.conf.sample b/src/backend/libpq/pg_hba.conf.sample index b64c8dea97c..475100f8865 100644 --- a/src/backend/libpq/pg_hba.conf.sample +++ b/src/backend/libpq/pg_hba.conf.sample @@ -109,14 +109,14 @@ # TYPE DATABASE USER ADDRESS METHOD -@remove-line-for-nolocal@# "local" is for Unix domain socket connections only -@remove-line-for-nolocal@local all all @authmethodlocal@ +# "local" is for Unix domain socket connections only +local all all @authmethodlocal@ # IPv4 local connections: host all all 127.0.0.1/32 @authmethodhost@ # IPv6 local connections: host all all ::1/128 @authmethodhost@ # Allow replication connections from localhost, by a user with the # replication privilege. -@remove-line-for-nolocal@local replication all @authmethodlocal@ +local replication all @authmethodlocal@ host replication all 127.0.0.1/32 @authmethodhost@ host replication all ::1/128 @authmethodhost@ diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index a3980e5535f..7c49dd433a7 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -1463,9 +1463,6 @@ setup_config(void) conflines = readfile(hba_file); - conflines = replace_token(conflines, "@remove-line-for-nolocal@", ""); - - /* * Probe to see if there is really any platform support for IPv6, and * comment out the relevant pg_hba line if not. This avoids runtime

Message-ID: <2287786.1771458157@sss.pgh.pa.us>
Permalink:  ../2287786.1771458157@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2287786.1771458157@sss.pgh.pa.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
  Subject: Re: @remove-line-for-nolocal@ is dead code
  In-Reply-To: <2287786.1771458157@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox