mirror of https://github.com/postgres/postgres
tests: Rename conflicting role names
These cause problems when running installcheck-world USE_MODULE_DB=1 with -j. Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/20221003234111.4ob7yph6r4g4ywhu@awork3.anarazel.de
This commit is contained in:
parent
902ab2fcef
commit
6a20b04f04
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue