Skip to content

Commit

Permalink
Updated BABEL-3844-vu-cleanup expected file
Browse files Browse the repository at this point in the history
Signed-off-by: ANJU BHARTI <[email protected]>
  • Loading branch information
ANJU BHARTI committed Aug 16, 2024
1 parent ec5d2b5 commit 149ad22
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
34 changes: 17 additions & 17 deletions contrib/babelfishpg_tsql/src/pl_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -3443,24 +3443,24 @@ bbf_ProcessUtility(PlannedStmt *pstmt,
errmsg("Could not drop login '%s' as the user is currently logged in.", role_name)));
}
/* If user/role, check for current_user's privileges */
else if (drop_user || drop_role)
{
const char *db_owner_name;
char *db_principal;
int role_oid = get_role_oid(role_name, true);
else if (drop_user || drop_role)
{
const char *db_owner_name;
char *db_principal;
int role_oid = get_role_oid(role_name, true);

if (drop_user)
db_principal = "user";
else
db_principal = "role";
/* must be database owner to drop user/role */
db_owner_name = get_db_owner_name(get_cur_db_name());
if ((!stmt->missing_ok && !OidIsValid(role_oid)) || !is_member_of_role(GetUserId(), get_role_oid(db_owner_name, false)))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("Cannot drop the %s '%s', because it does not exist or you do not have permission.", db_principal, role_name)));
}
if (drop_user)
db_principal = "user";
else
db_principal = "role";

/* must be database owner to drop user/role */
db_owner_name = get_db_owner_name(get_cur_db_name());
if ((!stmt->missing_ok && !OidIsValid(role_oid)) || !is_member_of_role(GetUserId(), get_role_oid(db_owner_name, false)))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("Cannot drop the %s '%s', because it does not exist or you do not have permission.", db_principal, role_name)));
}

/*
* We have performed all the permissions checks.
Expand Down
2 changes: 1 addition & 1 deletion test/JDBC/expected/BABEL-3844-vu-cleanup.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ drop user test_user;
GO
~~ERROR (Code: 33557097)~~

~~ERROR (Message: role "master_test_user" does not exist)~~
~~ERROR (Message: Cannot drop the user 'master_test_user', because it does not exist or you do not have permission.)~~


drop login [babel\aduser1];
Expand Down

0 comments on commit 149ad22

Please sign in to comment.