Re: [PATCH] Use role name "system_user" instead of "user" for unsafe_tests

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Use role name "system_user" instead of "user" for unsafe_tests
Date: 2023-04-11 19:03:47
Message-ID: 63df5f2b-9209-6406-0102-6076305c43d6@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2023-04-11 Tu 14:25, Aleksander Alekseev wrote:
> Hi,
>
> While playing with a new single board computer (VisionFive 2) I
> discovered that postgresql:unsafe_tests suite fails like this:
>
> ```
> --- /home/user/projects/postgresql/src/test/modules/unsafe_tests/expected/rolenames.out
> 2023-04-11 14:58:57.844550612 +0000
> +++ /home/user/projects/postgresql/build/testrun/unsafe_tests/regress/results/rolenames.out
> 2023-04-11 17:54:22.999024391 +0000
> @@ -53,6 +53,7 @@
> CREATE ROLE "current_user";
> CREATE ROLE "session_user";
> CREATE ROLE "user";
> +ERROR: role "user" already exists
> RESET client_min_messages;
> CREATE ROLE current_user; -- error
> ERROR: CURRENT_USER cannot be used as a role name here
> @@ -1089,4 +1090,5 @@
> DROP OWNED BY regress_testrol0, "Public", "current_role",
> "current_user", regress_testrol1, regress_testrol2, regress_testrolx
> CASCADE;
> DROP ROLE regress_testrol0, regress_testrol1, regress_testrol2,
> regress_testrolx;
> DROP ROLE "Public", "None", "current_role", "current_user",
> "session_user", "user";
> +ERROR: current user cannot be dropped
> DROP ROLE regress_role_haspriv, regress_role_nopriv;
> ```
>
> This happens because the developers of this SBC choose the default
> username "user", which I had no reason to change.
>
> Test merely checks that we can distinguish a username "user" from the
> USER keyword. Maybe it's worth replacing "user" with "system_user"? It
> is also a keyword but is a less likely choice for the OS user name.
>

I don't think we can protect against all possible user names. Wouldn't
it be better to run the tests under an OS user with a different name,
like "marmaduke"? ("user" is a truly terrible default user name).

cheers

andrew

--
Andrew Dunstan
EDB:https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2023-04-11 19:10:06 Re: [PATCH] Use role name "system_user" instead of "user" for unsafe_tests
Previous Message Alexander Lakhin 2023-04-11 19:00:00 Re: refactoring relation extension and BufferAlloc(), faster COPY