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

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Quote role name in test/authentication/t/003_peer.pl
Date: 2026-07-27 04:38:57
Message-ID: 20260727133857.fbd23d43d422f10f376a8bee@sraoss.co.jp
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
test_authentication_003_pear.patch text/x-diff 591 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-07-27 05:14:09 Re: Quote role name in test/authentication/t/003_peer.pl
Previous Message Laurenz Albe 2026-07-27 04:07:32 Re: timestamp vs. timestamptz comparisons inconsistently ordered under DST