From fee4e186f18134df929618bbd00cc1519149f144 Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Sun, 25 Sep 2022 16:49:51 -0700
Subject: [PATCH v2 1/3] tests: Rename conflicting role names

These cause problems when running installcheck concurrently.
---
 src/pl/plperl/expected/plperl_setup.out       | 30 +++++++++----------
 src/pl/plperl/sql/plperl_setup.sql            | 30 +++++++++----------
 contrib/adminpack/expected/adminpack.out      | 20 ++++++-------
 contrib/adminpack/sql/adminpack.sql           | 20 ++++++-------
 .../passwordcheck/expected/passwordcheck.out  | 16 +++++-----
 contrib/passwordcheck/sql/passwordcheck.sql   | 16 +++++-----
 6 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/src/pl/plperl/expected/plperl_setup.out b/src/pl/plperl/expected/plperl_setup.out
index 5234febefd6..5537a95ccc2 100644
--- a/src/pl/plperl/expected/plperl_setup.out
+++ b/src/pl/plperl/expected/plperl_setup.out
@@ -4,9 +4,9 @@
 -- Before going ahead with the to-be-tested installations, verify that
 -- a non-superuser is allowed to install plperl (but not plperlu) when
 -- suitable permissions have been granted.
-CREATE USER regress_user1;
-CREATE USER regress_user2;
-SET ROLE regress_user1;
+CREATE USER regress_plperl_user1;
+CREATE USER regress_plperl_user2;
+SET ROLE regress_plperl_user1;
 CREATE EXTENSION plperl;  -- fail
 ERROR:  permission denied to create extension "plperl"
 HINT:  Must have CREATE privilege on current database to create this extension.
@@ -16,18 +16,18 @@ HINT:  Must be superuser to create this extension.
 RESET ROLE;
 DO $$
 begin
-  execute format('grant create on database %I to regress_user1',
+  execute format('grant create on database %I to regress_plperl_user1',
                  current_database());
 end;
 $$;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
 CREATE EXTENSION plperl;
 CREATE EXTENSION plperlu;  -- fail
 ERROR:  permission denied to create extension "plperlu"
 HINT:  Must be superuser to create this extension.
 CREATE SCHEMA plperl_setup_scratch;
 SET search_path = plperl_setup_scratch;
-GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_user2;
+GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_plperl_user2;
 CREATE FUNCTION foo1() returns int language plperl as '1;';
 SELECT foo1();
  foo1 
@@ -38,15 +38,15 @@ SELECT foo1();
 -- Must reconnect to avoid failure with non-MULTIPLICITY Perl interpreters
 \c -
 SET search_path = plperl_setup_scratch;
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
 -- Should be able to change privileges on the language
 revoke all on language plperl from public;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user2;
 CREATE FUNCTION foo2() returns int language plperl as '2;';  -- fail
 ERROR:  permission denied for language plperl
-SET ROLE regress_user1;
-grant usage on language plperl to regress_user2;
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user1;
+grant usage on language plperl to regress_plperl_user2;
+SET ROLE regress_plperl_user2;
 CREATE FUNCTION foo2() returns int language plperl as '2;';
 SELECT foo2();
  foo2 
@@ -54,7 +54,7 @@ SELECT foo2();
     2
 (1 row)
 
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
 -- Should be able to drop the extension, but not the language per se
 DROP LANGUAGE plperl CASCADE;
 ERROR:  cannot drop language plperl because extension plperl requires it
@@ -65,9 +65,9 @@ DETAIL:  drop cascades to function foo1()
 drop cascades to function foo2()
 -- Clean up
 RESET ROLE;
-DROP OWNED BY regress_user1;
-DROP USER regress_user1;
-DROP USER regress_user2;
+DROP OWNED BY regress_plperl_user1;
+DROP USER regress_plperl_user1;
+DROP USER regress_plperl_user2;
 -- Now install the versions that will be used by subsequent test scripts.
 CREATE EXTENSION plperl;
 CREATE EXTENSION plperlu;
diff --git a/src/pl/plperl/sql/plperl_setup.sql b/src/pl/plperl/sql/plperl_setup.sql
index a89cf56617e..0eac9156294 100644
--- a/src/pl/plperl/sql/plperl_setup.sql
+++ b/src/pl/plperl/sql/plperl_setup.sql
@@ -6,10 +6,10 @@
 -- a non-superuser is allowed to install plperl (but not plperlu) when
 -- suitable permissions have been granted.
 
-CREATE USER regress_user1;
-CREATE USER regress_user2;
+CREATE USER regress_plperl_user1;
+CREATE USER regress_plperl_user2;
 
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
 
 CREATE EXTENSION plperl;  -- fail
 CREATE EXTENSION plperlu;  -- fail
@@ -18,18 +18,18 @@ RESET ROLE;
 
 DO $$
 begin
-  execute format('grant create on database %I to regress_user1',
+  execute format('grant create on database %I to regress_plperl_user1',
                  current_database());
 end;
 $$;
 
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
 
 CREATE EXTENSION plperl;
 CREATE EXTENSION plperlu;  -- fail
 CREATE SCHEMA plperl_setup_scratch;
 SET search_path = plperl_setup_scratch;
-GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_user2;
+GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_plperl_user2;
 
 CREATE FUNCTION foo1() returns int language plperl as '1;';
 SELECT foo1();
@@ -38,25 +38,25 @@ SELECT foo1();
 \c -
 SET search_path = plperl_setup_scratch;
 
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
 
 -- Should be able to change privileges on the language
 revoke all on language plperl from public;
 
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user2;
 
 CREATE FUNCTION foo2() returns int language plperl as '2;';  -- fail
 
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
 
-grant usage on language plperl to regress_user2;
+grant usage on language plperl to regress_plperl_user2;
 
-SET ROLE regress_user2;
+SET ROLE regress_plperl_user2;
 
 CREATE FUNCTION foo2() returns int language plperl as '2;';
 SELECT foo2();
 
-SET ROLE regress_user1;
+SET ROLE regress_plperl_user1;
 
 -- Should be able to drop the extension, but not the language per se
 DROP LANGUAGE plperl CASCADE;
@@ -64,9 +64,9 @@ DROP EXTENSION plperl CASCADE;
 
 -- Clean up
 RESET ROLE;
-DROP OWNED BY regress_user1;
-DROP USER regress_user1;
-DROP USER regress_user2;
+DROP OWNED BY regress_plperl_user1;
+DROP USER regress_plperl_user1;
+DROP USER regress_plperl_user2;
 
 -- Now install the versions that will be used by subsequent test scripts.
 CREATE EXTENSION plperl;
diff --git a/contrib/adminpack/expected/adminpack.out b/contrib/adminpack/expected/adminpack.out
index 76aafe6316a..6bcf2217f25 100644
--- a/contrib/adminpack/expected/adminpack.out
+++ b/contrib/adminpack/expected/adminpack.out
@@ -36,10 +36,10 @@ SELECT pg_read_file('test_file1');
 
 -- disallowed file paths for non-superusers and users who are
 -- not members of pg_write_server_files
-CREATE ROLE regress_user1;
-GRANT pg_read_all_settings TO regress_user1;
-GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_user1;
-SET ROLE regress_user1;
+CREATE ROLE regress_adminpack_user1;
+GRANT pg_read_all_settings TO regress_adminpack_user1;
+GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_adminpack_user1;
+SET ROLE regress_adminpack_user1;
 SELECT pg_file_write('../test_file0', 'test0', false);
 ERROR:  path must be in or below the current directory
 SELECT pg_file_write('/tmp/test_file0', 'test0', false);
@@ -53,9 +53,9 @@ SELECT pg_file_write(current_setting('data_directory') || '/test_file4', 'test4'
 SELECT pg_file_write(current_setting('data_directory') || '/../test_file4', 'test4', false);
 ERROR:  absolute path not allowed
 RESET ROLE;
-REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_user1;
-REVOKE pg_read_all_settings FROM regress_user1;
-DROP ROLE regress_user1;
+REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_adminpack_user1;
+REVOKE pg_read_all_settings FROM regress_adminpack_user1;
+DROP ROLE regress_adminpack_user1;
 -- sync
 SELECT pg_file_sync('test_file1'); -- sync file
  pg_file_sync 
@@ -153,8 +153,8 @@ SELECT pg_file_unlink('test_file4');
 (1 row)
 
 -- superuser checks
-CREATE USER regress_user1;
-SET ROLE regress_user1;
+CREATE USER regress_adminpack_user1;
+SET ROLE regress_adminpack_user1;
 SELECT pg_file_write('test_file0', 'test0', false);
 ERROR:  permission denied for function pg_file_write
 SELECT pg_file_sync('test_file0');
@@ -167,6 +167,6 @@ ERROR:  permission denied for function pg_file_unlink
 SELECT pg_logdir_ls();
 ERROR:  permission denied for function pg_logdir_ls
 RESET ROLE;
-DROP USER regress_user1;
+DROP USER regress_adminpack_user1;
 -- no further tests for pg_logdir_ls() because it depends on the
 -- server's logging setup
diff --git a/contrib/adminpack/sql/adminpack.sql b/contrib/adminpack/sql/adminpack.sql
index 918d0bdc65e..5776c9af0d1 100644
--- a/contrib/adminpack/sql/adminpack.sql
+++ b/contrib/adminpack/sql/adminpack.sql
@@ -14,20 +14,20 @@ SELECT pg_read_file('test_file1');
 
 -- disallowed file paths for non-superusers and users who are
 -- not members of pg_write_server_files
-CREATE ROLE regress_user1;
+CREATE ROLE regress_adminpack_user1;
 
-GRANT pg_read_all_settings TO regress_user1;
-GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_user1;
+GRANT pg_read_all_settings TO regress_adminpack_user1;
+GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_adminpack_user1;
 
-SET ROLE regress_user1;
+SET ROLE regress_adminpack_user1;
 SELECT pg_file_write('../test_file0', 'test0', false);
 SELECT pg_file_write('/tmp/test_file0', 'test0', false);
 SELECT pg_file_write(current_setting('data_directory') || '/test_file4', 'test4', false);
 SELECT pg_file_write(current_setting('data_directory') || '/../test_file4', 'test4', false);
 RESET ROLE;
-REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_user1;
-REVOKE pg_read_all_settings FROM regress_user1;
-DROP ROLE regress_user1;
+REVOKE EXECUTE ON FUNCTION pg_file_write(text,text,bool) FROM regress_adminpack_user1;
+REVOKE pg_read_all_settings FROM regress_adminpack_user1;
+DROP ROLE regress_adminpack_user1;
 
 -- sync
 SELECT pg_file_sync('test_file1'); -- sync file
@@ -59,8 +59,8 @@ SELECT pg_file_unlink('test_file4');
 
 
 -- superuser checks
-CREATE USER regress_user1;
-SET ROLE regress_user1;
+CREATE USER regress_adminpack_user1;
+SET ROLE regress_adminpack_user1;
 
 SELECT pg_file_write('test_file0', 'test0', false);
 SELECT pg_file_sync('test_file0');
@@ -69,7 +69,7 @@ SELECT pg_file_unlink('test_file0');
 SELECT pg_logdir_ls();
 
 RESET ROLE;
-DROP USER regress_user1;
+DROP USER regress_adminpack_user1;
 
 
 -- no further tests for pg_logdir_ls() because it depends on the
diff --git a/contrib/passwordcheck/expected/passwordcheck.out b/contrib/passwordcheck/expected/passwordcheck.out
index e04cda6bd95..2027681daf6 100644
--- a/contrib/passwordcheck/expected/passwordcheck.out
+++ b/contrib/passwordcheck/expected/passwordcheck.out
@@ -1,19 +1,19 @@
 LOAD 'passwordcheck';
-CREATE USER regress_user1;
+CREATE USER regress_passwordcheck_user1;
 -- ok
-ALTER USER regress_user1 PASSWORD 'a_nice_long_password';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'a_nice_long_password';
 -- error: too short
-ALTER USER regress_user1 PASSWORD 'tooshrt';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'tooshrt';
 ERROR:  password is too short
 -- error: contains user name
-ALTER USER regress_user1 PASSWORD 'xyzregress_user1';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'xyzregress_passwordcheck_user1';
 ERROR:  password must not contain user name
 -- error: contains only letters
-ALTER USER regress_user1 PASSWORD 'alessnicelongpassword';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'alessnicelongpassword';
 ERROR:  password must contain both letters and nonletters
 -- encrypted ok (password is "secret")
-ALTER USER regress_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md592350e12ac34e52dd598f90893bb3ae7';
 -- error: password is user name
-ALTER USER regress_user1 PASSWORD 'md5e589150ae7d28f93333afae92b36ef48';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md507a112732ed9f2087fa90b192d44e358';
 ERROR:  password must not equal user name
-DROP USER regress_user1;
+DROP USER regress_passwordcheck_user1;
diff --git a/contrib/passwordcheck/sql/passwordcheck.sql b/contrib/passwordcheck/sql/passwordcheck.sql
index d98796ac494..1fbd6b0e96e 100644
--- a/contrib/passwordcheck/sql/passwordcheck.sql
+++ b/contrib/passwordcheck/sql/passwordcheck.sql
@@ -1,23 +1,23 @@
 LOAD 'passwordcheck';
 
-CREATE USER regress_user1;
+CREATE USER regress_passwordcheck_user1;
 
 -- ok
-ALTER USER regress_user1 PASSWORD 'a_nice_long_password';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'a_nice_long_password';
 
 -- error: too short
-ALTER USER regress_user1 PASSWORD 'tooshrt';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'tooshrt';
 
 -- error: contains user name
-ALTER USER regress_user1 PASSWORD 'xyzregress_user1';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'xyzregress_passwordcheck_user1';
 
 -- error: contains only letters
-ALTER USER regress_user1 PASSWORD 'alessnicelongpassword';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'alessnicelongpassword';
 
 -- encrypted ok (password is "secret")
-ALTER USER regress_user1 PASSWORD 'md51a44d829a20a23eac686d9f0d258af13';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md592350e12ac34e52dd598f90893bb3ae7';
 
 -- error: password is user name
-ALTER USER regress_user1 PASSWORD 'md5e589150ae7d28f93333afae92b36ef48';
+ALTER USER regress_passwordcheck_user1 PASSWORD 'md507a112732ed9f2087fa90b192d44e358';
 
-DROP USER regress_user1;
+DROP USER regress_passwordcheck_user1;
-- 
2.37.3.542.gdd3f6c4cae

