On Thu, 2023-10-05 at 14:58 +0000, Jon Erdman wrote:
> > > > For the proposal (this one is a bit Apple specific): because my team
> > > > offers managed postgres to our Apple-internal customers, many of whom
> > > > are not database experts, or at least not postgres experts, we'd like to
> > > > be able to toggle the availability of UNLOGGED tables in
> > > > postgresql.conf, so our less clueful users have fewer footguns.
>
> Someone on linked-in suggested an event trigger, so now I'm thinking of
> a custom extension that would do nothing but create said event trigger,
> and maybe could be toggled with a customized setting (but that might
> allow users to turn it off themselves...which is maybe ok).
An event trigger is the perfect solution for this requirement.
> If the extension were installed by the DBA user, the customer wouldn't
> be able to drop it, and if we decided to give them an exception, we just
> drop or disable the extension.
Right. Also, only a superuser can create or drop event triggers.
> As a second more general question: could my original idea (i.e. sans
> event trigger) be implemented in an extension somehow, or is that not
> technically possible (I suspect not)?
You could perhaps use "object_access_hook" in an extension.
Yours,
Laurenz Albe