Re: Quote role name in test/authentication/t/003_peer.pl

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Quote role name in test/authentication/t/003_peer.pl
Date: 2026-07-27 05:14:09
Message-ID: ambpIaZCGd_R8y59@paquier.xyz
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 27, 2026 at 01:38:57PM +0900, Yugo Nagata wrote:
> If $mapped_name contains a hyphen, this results in a syntax error.
> The attached patch fixes this by properly quoting the role name:
>
> $node->safe_psql('postgres', "CREATE ROLE \"$mapped_name\" LOGIN");
>
> # Create target role for \1 tests.
> my $mapped_name = "test${regex_test_string}map${regex_test_string}user";
> -$node->safe_psql('postgres', "CREATE ROLE $mapped_name LOGIN");
> +$node->safe_psql('postgres', "CREATE ROLE \"$mapped_name\" LOGIN");

I doubt that this is worth beyond what you are proposing here, so just
applying double quotes are you are doing sounds good to me. Will fix
and backpatch on portability ground.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-07-27 05:26:31 Re: sequencesync worker race with REFRESH SEQUENCES
Previous Message Yugo Nagata 2026-07-27 04:38:57 Quote role name in test/authentication/t/003_peer.pl