Re: Trigger function - Mailing list pgsql-novice

From David G. Johnston
Subject Re: Trigger function
Date
Msg-id CAKFQuwY72k5ngAb+XXwKjBDtqhmqjDXPoAfYGv6AxGXTCsM3NQ@mail.gmail.com
Whole thread Raw
In response to Re: Trigger function  ("Nicolas Mitchell" <mitchelln@posteo.net>)
Responses Re: Trigger function  ("Nicolas Mitchell" <mitchelln@posteo.net>)
List pgsql-novice
On Tue, Jul 27, 2021 at 5:41 PM Nicolas Mitchell <mitchelln@posteo.net> wrote:
If within PG, then
I’d view that as something I should explore. Otherwise, I’m not
keen, at present, to push things into an application when they can be
achieved within PG - this being my own (fairly uneducated) preference.


I'd probably do "CREATE PROCEDURE create_new_host(new_host_name text, new_host_domain integer) ... SECURITY DEFINER"

Then grant permission to call that procedure to roles that need to create new host records.  Your original CTE would then be executed within the procedure.  Roles would not be given permission to insert directly into the host or related tables - but the owner of the procedure would.

David J.



pgsql-novice by date:

Previous
From: "Nicolas Mitchell"
Date:
Subject: Re: Trigger function
Next
From: "Nicolas Mitchell"
Date:
Subject: Re: Trigger function