mirror of
https://github.com/postgres/postgres.git
synced 2025-06-01 00:01:20 -04:00
Marginal performance improvement in aclmask(): don't bother with
testing ownership if the caller isn't interested in any GOPTION bits (which is the common case). It did not matter in 8.0 where the ownership test was just a trivial equality test, but it matters now.
This commit is contained in:
parent
b888ab82da
commit
426d0158ca
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.123 2005/07/28 22:27:02 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.124 2005/10/07 19:59:34 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1013,10 +1013,11 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
|
|||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
/* Owner always implicitly has all grant options */
|
/* Owner always implicitly has all grant options */
|
||||||
if (has_privs_of_role(roleid, ownerId))
|
if ((mask & ACLITEM_ALL_GOPTION_BITS) &&
|
||||||
|
has_privs_of_role(roleid, ownerId))
|
||||||
{
|
{
|
||||||
result = mask & ACLITEM_ALL_GOPTION_BITS;
|
result = mask & ACLITEM_ALL_GOPTION_BITS;
|
||||||
if (result == mask)
|
if ((how == ACLMASK_ALL) ? (result == mask) : (result != 0))
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1024,7 +1025,7 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
|
|||||||
aidat = ACL_DAT(acl);
|
aidat = ACL_DAT(acl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check privileges granted directly to user or to public
|
* Check privileges granted directly to roleid or to public
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
@ -1040,11 +1041,11 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check privileges granted indirectly via roles.
|
* Check privileges granted indirectly via role memberships.
|
||||||
* We do this in a separate pass to minimize expensive indirect
|
* We do this in a separate pass to minimize expensive indirect
|
||||||
* membership tests. In particular, it's worth testing whether
|
* membership tests. In particular, it's worth testing whether
|
||||||
* a given ACL entry grants any privileges still of interest before
|
* a given ACL entry grants any privileges still of interest before
|
||||||
* we perform the is_member test.
|
* we perform the has_privs_of_role test.
|
||||||
*/
|
*/
|
||||||
remaining = mask & ~result;
|
remaining = mask & ~result;
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user