will remove the domain part for users with system user names that end with
<literal>@mydomain.com</literal>, and allow any user whose system name ends with
<literal>@otherdomain.com</literal> to log in as <literal>guest</literal>.
+ Quoting a <replaceable>database-username</replaceable> containing
+ <literal>\1</literal> <emphasis>does not</emphasis> make
+ <literal>\1</literal> lose its special meaning.
</para>
<tip>
log_like =>
[qr/connection authenticated: identity="$system_user" method=peer/]);
+# Success as the regular expression matches and \1 is replaced in the given
+# subexpression, even if quoted.
+reset_pg_ident($node, 'mypeermap', qq{/^$system_user(.*)\$},
+ '"test\1mapuser"');
+test_role(
+ $node,
+ qq{testmapuser},
+ 'peer',
+ 0,
+ 'with regular expression in user name map with quoted \1 replaced',
+ log_like =>
+ [qr/connection authenticated: identity="$system_user" method=peer/]);
+
# Failure as the regular expression does not include a subexpression, but
# the database user contains \1, requesting a replacement.
reset_pg_ident($node, 'mypeermap', qq{/^$system_user\$}, '\1testmapuser');