From: | Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Simplify calls of pg_class_aclcheck when multiple modes are used |
Date: | 2014-10-06 17:58:11 |
Message-ID: | CAFcNs+pqkmmA5FjHUGzB5bdH7Lg-MWVuHwpex0_rvJi-Ro+57w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Aug 27, 2014 at 9:02 AM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
>
> Hi all,
>
> In a couple of code paths we do the following to check permissions on an
object:
> if (pg_class_aclcheck(relid, userid, ACL_USAGE) != ACLCHECK_OK &&
> pg_class_aclcheck(relid, userid, ACL_UPDATE) != ACLCHECK_OK)
> ereport(ERROR, blah);
>
> Wouldn't it be better to simplify that with a single call of
pg_class_aclcheck, gathering together the modes that need to be checked? In
the case above, the call to pg_class_aclcheck would become like that:
> if (pg_class_aclcheck(relid, userid,
> ACL_USAGE | ACL_UPDATE) != ACLCHECK_OK)
> ereport(ERROR, blah);
>
> That's not a critical thing, but it would save some cycles. Patch is
attached.
>
I did a little review:
- applied to master without errors
- no compiler warnings
- no regressions
It's a minor change and as Michael already said would save some cycles.
Marked as "Ready for commiter".
Regards,
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2014-10-06 17:58:16 | copy.c handling for RLS is insecure |
Previous Message | Fabrízio de Royes Mello | 2014-10-06 17:42:19 | Re: CREATE IF NOT EXISTS INDEX |