CDB_FederatedServer: Improve tests readability

This commit is contained in:
Raul Marin
2019-11-05 13:22:45 +01:00
parent 98b2b02199
commit bac7d79ab3
3 changed files with 49 additions and 49 deletions

View File

@@ -273,12 +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
SET client_min_messages = ERROR;
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;
RAISE EXCEPTION 'Not enough permissions to drop the server "%"', server;
END;
END
$$