Re: Allow database owners to CREATE EVENT TRIGGER

From: Steve Chavez <steve(at)supabase(dot)io>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow database owners to CREATE EVENT TRIGGER
Date: 2025-04-23 00:18:39
Message-ID: CAGRrpza3FchJrmuX7fVk2DwkOKha1UVOF8Dr+E-_9qvL_ebPow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> alter event trigger command which doesn’t need to be exercised here

That part does need to be tested, I modified
`AlterEventTriggerOwner_internal` to allow altering owners to regular
users. Before it was only restricted to superusers.

> Actually, leave the other member around, but not granted ownership, and
both create tables, to demonstrate that a non-superuser and non-owner is
unaffected by the trigger.

I've updated the tests accordingly. Please let me know if that's what you
had in mind.

Best regards,
Steve Chavez

On Sun, 20 Apr 2025 at 23:13, David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>
wrote:

> On Sunday, April 20, 2025, Steve Chavez <steve(at)supabase(dot)io> wrote:
>
>> > Also, this looks unconventional…
>> > EventTriggerCacheItem *item = (EventTriggerCacheItem*) lfirst_oid(lc);
>>
>> Just noticed the mistake there, I would have expected a compilation
>> error. New patch attached with the following change:
>>
>> EventTriggerCacheItem *item = lfirst(lc);
>>
>> On Sun, 20 Apr 2025 at 22:55, Steve Chavez <steve(at)supabase(dot)io> wrote:
>>
>>> Sorry, attached the output file.
>>>
>>>
> You can remove role member_1 and trigger..1 and “create table foo” from
> the nosuper script without any loss of test coverage. Or member2 trigger2
> table_bar along with the alter event trigger command which doesn’t need to
> be exercised here. Ownership is all that matters. Whether come to
> directly or via alter.
>
> Actually, leave the other member around, but not granted ownership, and
> both create tables, to demonstrate that a non-superuser and non-owner is
> unaffected by the trigger.
>
> David J.
>
>

Attachment Content-Type Size
v2-0001-Allow-regular-users-to-create-event-triggers.patch text/x-patch 12.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2025-04-23 00:33:09 Re: DOCS - create publication (tweak for generated columns)
Previous Message Jacob Champion 2025-04-23 00:01:44 Re: jsonapi: scary new warnings with LTO enabled