Re: [HACKERS] replace GrantObjectType with ObjectType

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [HACKERS] replace GrantObjectType with ObjectType
Date: 2017-12-20 00:56:52
Message-ID: CAB7nPqTUSnsT-G4_tQNH8bBRQJ0cJjiM6Z_UeyqrwgNpwCbuDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 20, 2017 at 5:43 AM, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> Peter Eisentraut wrote:
>> On 12/15/17 17:34, Michael Paquier wrote:
>> > On Sat, Dec 16, 2017 at 2:39 AM, Peter Eisentraut
>> > <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
>
>> > That's the whole point of not having "default" in the switches, no?
>> > Any object additions would be caught at compilation time.
>>
>> I think the purpose of EventTriggerSupportsGrantObjectType() is to tell
>> which object types are supported for event triggers. The purpose is not
>> to tell which object types are supported by GRANT.
>>
>> The way I have written it, if GRANT gets support for a new object type,
>> then event trigger support automatically happens, without having to
>> update another list.
>
> That's correct, and using a single implementation as in the posted patch
> is desirable. I was not happy about having to add
> EventTriggerSupportsGrantObjectType (c.f. commit 296f3a605384).

Hm. OK. I would have thought that allowing a new object to work
automatically is actually we would have liked to avoid for safety. So
complain withdrawn.

-stringify_adefprivs_objtype(GrantObjectType objtype)
+stringify_adefprivs_objtype(ObjectType objtype)
[...]
+ default:
+ elog(ERROR, "unrecognized grant object type: %d", (int) objtype);
+ return "???"; /* keep compiler quiet */
}
-
- elog(ERROR, "unrecognized grant object type: %d", (int) objtype);
- return "???"; /* keep compiler quiet */
Still this portion in 0001 is something that we try to avoid as much
as possible, no? I would have thought that all object types should be
listed directly so as nothing is missed in the future.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2017-12-20 01:16:54 Re: WIP: BRIN multi-range indexes
Previous Message leoaaryan 2017-12-20 00:54:13 Re: Statically linking ICU with Postgres