Re: correction suggestion for https://www.postgresql.org/docs/17/auth-username-maps.html
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: "David G. Johnston" <david.g.johnston@gmail.com>
Cc: alexey.shishkin@enterprisedb.com, pgsql-docs@lists.postgresql.org
Date: 2025-07-09T22:05:46Z
Lists: pgsql-docs
Attachments
- wip-allow-multiple-backslash-ones.patch (text/x-diff) patch
I wrote: > "David G. Johnston" <david.g.johnston@gmail.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
Commits
-
Doc: clarify description of regexp fields in pg_ident.conf.
- ff6783ce5260 16.10 landed
- f8ce5dea433c 18.0 landed
- dc70816fde6e 13.22 landed
- b70a2e8a1a0d 17.6 landed
- 6f7d016e917e 14.19 landed
- 5fe55a0fe40e 19 (unreleased) landed
- 2132ced7dc97 15.14 landed
-
In username-map substitution, cope with more than one \1.
- 3c4e26a62c31 19 (unreleased) landed