Re: Trigger function

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Nicolas Mitchell <mitchelln(at)posteo(dot)net>
Cc: hubert depesz lubaczewski <depesz(at)depesz(dot)com>, pgsql-novice <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: Trigger function
Date: 2021-07-28 00:46:54
Message-ID: CAKFQuwY72k5ngAb+XXwKjBDtqhmqjDXPoAfYGv6AxGXTCsM3NQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, Jul 27, 2021 at 5:41 PM Nicolas Mitchell <mitchelln(at)posteo(dot)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.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nicolas Mitchell 2021-07-28 00:49:48 Re: Trigger function
Previous Message Nicolas Mitchell 2021-07-28 00:41:55 Re: Trigger function