Quote role name in test/authentication/t/003_peer.pl
Hi,
I noticed that test/authentication/t/003_peer.pl can fail when the system_user
name contains characters that require quoting in SQL, such as a hyphen.
The test creates a role using a name derived from the OS user:
$node->safe_psql('postgres', "CREATE ROLE $mapped_name LOGIN");
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");
Regards,
Yugo Nagata
--
Yugo Nagata <nagata@sraoss.co.jp>
Attachments:
test_authentication_003_pear.patchtext/x-diff; name=test_authentication_003_pear.patchDownload+1-1
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
On Mon, Jul 27, 2026 at 02:14:09PM +0900, Michael Paquier wrote:
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.
Done as 5713b437abed, down to v19.
--
Michael