Improve tests readability and test deleting a server from granted access

This commit is contained in:
Raul Marin
2019-11-05 11:19:50 +01:00
parent 10ed64789d
commit 98b2b02199
3 changed files with 86 additions and 26 deletions

View File

@@ -273,9 +273,13 @@ DECLARE
server_internal text := @extschema@.__CDB_FS_Generate_Server_Name(input_name := server, check_existence := true);
role_name name := @extschema@.__CDB_FS_Generate_Server_Role_Name(server_internal);
BEGIN
EXECUTE FORMAT ('DROP USER MAPPING FOR public SERVER %I', server_internal);
EXECUTE FORMAT ('DROP OWNED BY %I CASCADE', role_name);
EXECUTE FORMAT ('DROP ROLE %I', role_name);
BEGIN
EXECUTE FORMAT ('DROP USER MAPPING FOR public SERVER %I', server_internal);
EXECUTE FORMAT ('DROP OWNED BY %I CASCADE', role_name);
EXECUTE FORMAT ('DROP ROLE %I', role_name);
EXCEPTION WHEN OTHERS THEN
RAISE EXCEPTION 'Unnecessary permissions to drop the server "%": %', server, SQLERRM;
END;
END
$$
LANGUAGE PLPGSQL VOLATILE PARALLEL UNSAFE;