Re: [HACKERS] replace GrantObjectType with ObjectType

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [HACKERS] replace GrantObjectType with ObjectType
Дата
Msg-id CAB7nPqQEc9EvKNrrrvTz03at27VTDM0JqnUid=PWOrgJ_-75FA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] replace GrantObjectType with ObjectType  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
On Thu, Oct 12, 2017 at 5:43 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> Michael Paquier wrote:
>> 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.
>
> +1 for this.
>
>> -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.
>
> Yeah, we've found it useful to remove default: clauses in some switch
> blocks so that we get compile warnings when we forget to add a new type
> (c.f. commit e84c0195980f).  Let's not add any more of those.

Here is an idea: let's keep EventTriggerSupportsGrantObjectType which
instead of ACL_OBJECT_* uses OBJECT_*, but complains with an error if
the object is not supported with GRANT. Not need for a default in this
case.
-- 
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 по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: [HACKERS] [PATCH] pageinspect function to decode infomasks
Следующее
От: "Seki, Eiji"
Дата:
Сообщение: [HACKERS] Fix typo in blvacuum.c