Explicit null check for not found role
This commit is contained in:
parent
566adfb0ce
commit
00e9cc5a79
@ -54,6 +54,10 @@ DECLARE
|
||||
BEGIN
|
||||
cdb_group_role := cartodb._CDB_Group_GroupRole(group_name);
|
||||
cdb_user_role := cartodb._CDB_User_RoleFromUsername(username);
|
||||
IF(cdb_group_role IS NULL OR cdb_user_role IS NULL)
|
||||
THEN
|
||||
RAISE EXCEPTION 'Group role (%) and user role (%) must be already existing', cdb_group_role, cdb_user_role;
|
||||
END IF;
|
||||
EXECUTE format('GRANT "%s" TO "%s"', cdb_group_role, cdb_user_role);
|
||||
END
|
||||
$$ LANGUAGE PLPGSQL VOLATILE;
|
||||
|
Loading…
Reference in New Issue
Block a user