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 <[email protected]>
diff --git a/src/test/authentication/t/003_peer.pl b/src/test/authentication/t/003_peer.pl
index 5c774babd32..686e409ce6a 100644
--- a/src/test/authentication/t/003_peer.pl
+++ b/src/test/authentication/t/003_peer.pl
@@ -213,7 +213,7 @@ test_role(
 
 # 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");
 
 # Success as the regular expression matches and \1 is replaced in the given
 # subexpression.

Reply via email to