Skip to content

Commit

Permalink
fix a test
Browse files Browse the repository at this point in the history
  • Loading branch information
lohia-shalini committed Sep 23, 2024
1 parent 1c6763e commit fae4331
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 4 additions & 0 deletions contrib/babelfishpg_tds/src/backend/tds/tdsutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,9 @@ is_babelfish_role(const char *role)
Oid bbf_master_guest_oid;
Oid bbf_tempdb_guest_oid;
Oid bbf_msdb_guest_oid;
Oid bbf_role_admin_oid = InvalidOid;

bbf_role_admin_oid = get_role_oid(BABELFISH_ROLE_ADMIN, false);

sysadmin_oid = get_role_oid(BABELFISH_SYSADMIN, true); /* missing OK */
role_oid = get_role_oid(role, true); /* missing OK */
Expand All @@ -947,6 +950,7 @@ is_babelfish_role(const char *role)
return false;

if (is_member_of_role(sysadmin_oid, role_oid) ||
is_member_of_role(bbf_role_admin_oid, role_oid) ||
pg_strcasecmp(role, BABELFISH_ROLE_ADMIN) == 0) /* check if it is bbf_role_admin */
return true;

Expand Down
6 changes: 2 additions & 4 deletions test/JDBC/expected/database_roles.out
Original file line number Diff line number Diff line change
Expand Up @@ -582,17 +582,15 @@ drop role master_db_datareader;
go
~~ERROR (Code: 0)~~

~~ERROR (Message: ERROR: permission denied to drop role
Detail: Only roles with the CREATEROLE attribute and the ADMIN option on the target roles may drop roles.
~~ERROR (Message: ERROR: Babelfish-created logins/users/roles cannot be dropped or altered outside of a Babelfish session
Server SQLState: 42501)~~


drop role master_db_datawriter;
go
~~ERROR (Code: 0)~~

~~ERROR (Message: ERROR: permission denied to drop role
Detail: Only roles with the CREATEROLE attribute and the ADMIN option on the target roles may drop roles.
~~ERROR (Message: ERROR: Babelfish-created logins/users/roles cannot be dropped or altered outside of a Babelfish session
Server SQLState: 42501)~~


Expand Down

0 comments on commit fae4331

Please sign in to comment.