From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Simplify calls of pg_class_aclcheck when multiple modes are used |
Date: | 2014-08-27 12:02:40 |
Message-ID: | CAB7nPqTX3rRAaFTbe1h=PnUe7VO6+Q12VEZOf3qUNqmFDpL1vA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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.
Regards,
--
Michael
Attachment | Content-Type | Size |
---|---|---|
20140827_aclcheck_simplify.patch | text/x-patch | 2.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Fujii Masao | 2014-08-27 12:03:45 | Re: After switching primary server while using replication slot. |
Previous Message | Fujii Masao | 2014-08-27 11:56:46 | Re: Specifying the unit in storage parameter |