Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit426d015

Browse files
committed
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 ownershiptest was just a trivial equality test, but it matters now.
1 parentb888ab8 commit426d015

File tree

1 file changed

+7
-6
lines changed
  • src/backend/utils/adt

1 file changed

+7
-6
lines changed

‎src/backend/utils/adt/acl.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.123 2005/07/28 22:27:02 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/acl.c,v 1.124 2005/10/07 19:59:34 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1013,18 +1013,19 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
10131013
result=0;
10141014

10151015
/* Owner always implicitly has all grant options */
1016-
if (has_privs_of_role(roleid,ownerId))
1016+
if ((mask&ACLITEM_ALL_GOPTION_BITS)&&
1017+
has_privs_of_role(roleid,ownerId))
10171018
{
10181019
result=mask&ACLITEM_ALL_GOPTION_BITS;
1019-
if (result==mask)
1020+
if ((how==ACLMASK_ALL) ? (result==mask) : (result!=0))
10201021
returnresult;
10211022
}
10221023

10231024
num=ACL_NUM(acl);
10241025
aidat=ACL_DAT(acl);
10251026

10261027
/*
1027-
* Check privileges granted directly touser or to public
1028+
* Check privileges granted directly toroleid or to public
10281029
*/
10291030
for (i=0;i<num;i++)
10301031
{
@@ -1040,11 +1041,11 @@ aclmask(const Acl *acl, Oid roleid, Oid ownerId,
10401041
}
10411042

10421043
/*
1043-
* Check privileges granted indirectly viaroles.
1044+
* Check privileges granted indirectly viarole memberships.
10441045
* We do this in a separate pass to minimize expensive indirect
10451046
* membership tests. In particular, it's worth testing whether
10461047
* a given ACL entry grants any privileges still of interest before
1047-
* we perform theis_member test.
1048+
* we perform thehas_privs_of_role test.
10481049
*/
10491050
remaining=mask& ~result;
10501051
for (i=0;i<num;i++)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp