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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: alexey(dot)shishkin(at)enterprisedb(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: correction suggestion for https://www.postgresql.org/docs/17/auth-username-maps.html
Date: 2025-07-09 22:05:46
Message-ID: 1409232.1752098746@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

I wrote:
> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
>> I didn't add an example but felt the point "be referenced a single time
>> within" to be needed since, usefulness not withstanding, writing \1\1 for
>> database-username works but only the first instance of \1 is replaced.

> Hmm, I wonder if that isn't a bug we should fix. It's hard to believe
> anyone is relying on the second \1 *not* getting replaced, and perhaps
> there are use-cases for multiple replacements.

Here's a quick patch for that. I hacked up 003_peer.pl enough to
prove that multiple replacement works, but that test change is not
committable as-is because it assumes that the "system user" name
is "postgres". I don't like the existing test much either, since it
only tests the case of the substituted string being empty, which
means the substitution code could be quite broken and it wouldn't
notice. But I don't offhand see a way to improve that without
making assumptions about the incoming name...

regards, tom lane

Attachment Content-Type Size
wip-allow-multiple-backslash-ones.patch text/x-diff 3.6 KB

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Artem Fadeev 2025-07-10 00:45:56 Outdated typedefs in documentation
Previous Message Tom Lane 2025-07-09 19:30:04 Re: correction suggestion for https://www.postgresql.org/docs/17/auth-username-maps.html