Quote role name in test/authentication/t/003_peer.pl - Mailing list pgsql-hackers

From Yugo Nagata
Subject Quote role name in test/authentication/t/003_peer.pl
Date
Msg-id 20260727133857.fbd23d43d422f10f376a8bee@sraoss.co.jp
Whole thread
List pgsql-hackers
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>

Attachment

pgsql-hackers by date:

Previous
From: Richard Guo
Date:
Subject: Re: Fix missing FORMAT when deparsing JSON_ARRAY(query)
Next
From: Jakub Wartak
Date:
Subject: Re: log_postmaster_stats