Re: Inserts restricted to a trigger

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Miles Elam <miles(dot)elam(at)productops(dot)com>, pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Inserts restricted to a trigger
Date: 2019-06-18 00:29:54
Message-ID: 6fe78cce-7e74-926b-7d3d-2e09da698cc8@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 6/17/19 4:54 PM, Miles Elam wrote:
> Is there are way to restrict direct access to a table for inserts but
> allow a trigger on another table to perform an insert for that user?
>
> I'm trying to implement an audit table without allowing user tampering
> with the audit information.

Would the below not work?:
CREATE the table as superuser or other privileged user
Have trigger function run as above user(use SECURITY DEFINER)

>
>
> Thanks in advance,
>
> Miles Elam

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2019-06-18 00:34:33 Re: psql UPDATE field [tab] expands to DEFAULT?
Previous Message Jeff Janes 2019-06-18 00:23:47 Re: psql UPDATE field [tab] expands to DEFAULT?