"David G. Johnston" <david.g.johnston@xxxxxxxxx> writes: > On Sunday, April 21, 2024, yudhi s <learnerdatabase99@xxxxxxxxx> wrote: >> Are you saying something like below, in which we first create the >> function from super user and then execute the grant? But doesn't that mean, >> each time we want to create a new event trigger we have to be again >> dependent on the "super user" to modify the security definer function? > Dynamic SQL. See “execute” in plpgsql. You might as well just give that user superuser and be done with it. It's foolish to imagine that you have any shred of security left if you're letting a user that's not 100.00% trusted write event triggers. (Much less execute any SQL command whatsoever, which is what it sounds like David is suggesting you create a function to do.) regards, tom lane