From d85eef2c945466766b06de16171744ae3b676e92 Mon Sep 17 00:00:00 2001 From: Tanzeel Khan Date: Tue, 10 Oct 2023 14:04:40 +0000 Subject: [PATCH] check dialect in best grantor Signed-off-by: Tanzeel Khan --- src/backend/utils/adt/acl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 23b49dec127..8ae9652c21c 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -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; @@ -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);