Skip to content

Commit

Permalink
check dialect in best grantor
Browse files Browse the repository at this point in the history
Signed-off-by: Tanzeel Khan <[email protected]>
  • Loading branch information
tanscorpio7 committed Oct 10, 2023
1 parent c7a7453 commit d85eef2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/backend/utils/adt/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -5120,14 +5120,8 @@ select_best_grantor(Oid roleId, AclMode privileges,
return;
}

/*
* Otherwise we have to do a careful search to see if roleId has the
* privileges of any suitable role. Note: we can hang onto the result of
* roles_is_member_of() throughout this loop, because aclmask_direct()
* doesn't query any role memberships.
*/

if(roleId == get_role_oid("sysadmin", true))
if(sql_dialect == SQL_DIALECT_TSQL &&
roleId == get_role_oid("sysadmin", true))
{
AclMode sysadmin_privs;

Expand All @@ -5142,6 +5136,12 @@ select_best_grantor(Oid roleId, AclMode privileges,
}
}

/*
* Otherwise we have to do a careful search to see if roleId has the
* privileges of any suitable role. Note: we can hang onto the result of
* roles_is_member_of() throughout this loop, because aclmask_direct()
* doesn't query any role memberships.
*/
roles_list = roles_is_member_of(roleId, ROLERECURSE_PRIVS,
InvalidOid, NULL);

Expand Down

0 comments on commit d85eef2

Please sign in to comment.