Re: [HACKERS] replace GrantObjectType with ObjectType

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [HACKERS] replace GrantObjectType with ObjectType
Дата
Msg-id CAB7nPqSR8Rsh-rcMjv7_2D7oksByre4FrHUeyn_KreHgO_YUPg@mail.gmail.com
обсуждение исходный текст
Ответ на [HACKERS] replace GrantObjectType with ObjectType  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: [HACKERS] replace GrantObjectType with ObjectType  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
On Thu, Oct 12, 2017 at 7:55 AM, Peter Eisentraut
<peter.eisentraut@2ndquadrant.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


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] Re: [COMMITTERS] pgsql: Add configure infrastructureto detect support for C99's restric
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: [HACKERS] Discussion on missing optimizations