diff --git a/contrib/babelfishpg_tds/src/backend/tds/tdsutils.c b/contrib/babelfishpg_tds/src/backend/tds/tdsutils.c index dff1e6d58f5..3eedeff8f34 100644 --- a/contrib/babelfishpg_tds/src/backend/tds/tdsutils.c +++ b/contrib/babelfishpg_tds/src/backend/tds/tdsutils.c @@ -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 */ @@ -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; diff --git a/test/JDBC/expected/database_roles.out b/test/JDBC/expected/database_roles.out index 1ec2620c641..23e9ac673ed 100644 --- a/test/JDBC/expected/database_roles.out +++ b/test/JDBC/expected/database_roles.out @@ -582,8 +582,7 @@ 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)~~ @@ -591,8 +590,7 @@ 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)~~