Re: correction suggestion for https://www.postgresql.org/docs/17/auth-username-maps.html

David G. Johnston <david.g.johnston@gmail.com>

From: "David G. Johnston" <david.g.johnston@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: alexey.shishkin@enterprisedb.com, pgsql-docs@lists.postgresql.org
Date: 2025-07-13T19:27:09Z
Lists: pgsql-docs
On Sun, Jul 13, 2025 at 11:30 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:

> I figured out how to make the 003_peer.pl tests for \1 less
> hacky, and pushed that.  Here's a proposed patch for the
> documentation side of things, including your suggestion to
> make pg_ident.conf.sample match up better.
>
>
Thanks.  My goal of trying to be a bit more precise regarding the \1
reference is probably counter-productive.  The existing wording makes me
ask "why" to which the answer is "because if database-username is a regexp
a reference to \1 resolves to any capturing groups it defines; and if there
are none the regexp will be malformed and break when you attempt to
reload pg_hba.conf".  But that is a lot of words for something that is
unlikely to be encountered in practice and does distract the reader from
the main point.

(Likewise, the system-username regexp can contain more than one capture -
which are only available later in the system-username regexp - though again
it seems unlikely anyone is going to use that feature in this context.)

I'm good with this.

Thanks!

David J.

Commits

  1. Doc: clarify description of regexp fields in pg_ident.conf.

  2. In username-map substitution, cope with more than one \1.