From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: replace GrantObjectType with ObjectType |
Date: | 2017-10-12 05:59:52 |
Message-ID: | CAB7nPqSR8Rsh-rcMjv7_2D7oksByre4FrHUeyn_KreHgO_YUPg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Oct 12, 2017 at 7:55 AM, Peter Eisentraut
<peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> It seems to me that having ACL_OBJECT_* symbols alongside OBJECT_*
> symbols is not useful and leads to duplication. Digging around in the
> past suggests that we used to have a lot of these command-specific
> symbols but got rid of them over time, except that the ACL stuff was
> never touched. The attached patch accomplishes that.
That's always welcome:
14 files changed, 203 insertions(+), 254 deletions(-)
This needs an update:
$ git grep GrantObjectType
src/tools/pgindent/typedefs.list:GrantObjectType
-static const char *stringify_grantobjtype(GrantObjectType objtype);
-static const char *stringify_adefprivs_objtype(GrantObjectType objtype);
+static const char *stringify_grantobjtype(ObjectType objtype);
+static const char *stringify_adefprivs_objtype(ObjectType objtype);
stringify_grantobjtype should be renamed to stringify_objtype.
-bool
-EventTriggerSupportsGrantObjectType(GrantObjectType objtype)
-{
- switch (objtype)
- {
- case ACL_OBJECT_DATABASE:
- case ACL_OBJECT_TABLESPACE:
- /* no support for global objects */
- return false;
By removing that, if any GRANT/REVOKE support is added for another
object type, then EventTriggerSupportsObjectType would return true by
default instead of getting a compilation failure. I think that a
comment would be appropriate here:
GrantStmt *stmt = (GrantStmt *) parsetree;
- if (EventTriggerSupportsGrantObjectType(stmt->objtype))
+ if (EventTriggerSupportsObjectType(stmt->objtype))
ProcessUtilitySlow(pstate, pstmt, queryString,
Something like, "This checks for more object types than currently
supported by the GRANT statement"... Or at least something to outline
that risk.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Laurenz Albe | 2017-10-12 07:22:27 | Re: Discussion on missing optimizations |
Previous Message | Andres Freund | 2017-10-12 05:05:13 | Re: [HACKERS] Re: pgsql: Add configure infrastructure to detect support for C99's restric |