From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Miles Elam <miles.elam@productops.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Inserts restricted to a trigger
Date: Mon, 17 Jun 2019 17:29:54 -0700
Message-ID: <6fe78cce-7e74-926b-7d3d-2e09da698cc8@aklaver.com> (raw)
In-Reply-To: <CAALojA-Mn+V+j9gdS2-jyoCzAGrjwGQh2hJq0H1it5M4=UaHBw@mail.gmail.com>
References: <CAALojA-Mn+V+j9gdS2-jyoCzAGrjwGQh2hJq0H1it5M4=UaHBw@mail.gmail.com>
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.klaver@aklaver.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, miles.elam@productops.com
Subject: Re: Inserts restricted to a trigger
In-Reply-To: <6fe78cce-7e74-926b-7d3d-2e09da698cc8@aklaver.com>
References: <CAALojA-Mn+V+j9gdS2-jyoCzAGrjwGQh2hJq0H1it5M4=UaHBw@mail.gmail.com> <6fe78cce-7e74-926b-7d3d-2e09da698cc8@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox