From: Robert Treat <xzilla@users.sourceforge.net>
To: pgsql-sql@postgresql.org
Cc: Bryce Nesbitt <bryce1@obviously.com>
Subject: Re: Proposed archival read only trigger on rows - prevent history modification
Date: Thu, 21 Feb 2008 22:31:57 -0500
Message-ID: <200802212231.58019.xzilla@users.sourceforge.net> (raw)
In-Reply-To: <47B1580A.7050703@obviously.com>
References: <771732.23057.qm@web54301.mail.re2.yahoo.com>
<47B1580A.7050703@obviously.com>
On Tuesday 12 February 2008 03:25, Bryce Nesbitt wrote:
> Yes, the view approach has some advantages. But it still leaves the
> underlying tables naked to modification.
> And since the most likely error is... well... me (or another admin) at
> the SQL prompt, we want underlying tables protected also.
>
> chester c young wrote:
> > instead of triggers I use update-able views and permissions.
> >
> > 1. all dml goes through the view
> > 2. use rules on the view to do dml to the table
> > 3. in rules prevent updating all/any columns when whatever
> > 4. grant dml to view to your pgconnect user
> > 5. revoke dml from table to your pgconnect user
> >
> > imho another instance where rules rule. for example, you can easily
> > fit logging into the same view.
You can use rules on the underlying tables themselves (on update do nothing)
which tends to work pretty well. You can also add triggers into the mix to
raise errors on update. Also dont forget to revoke update/delete/install
privileges as appropriate. And look into vacuum freeze.
--
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: xzilla@users.sourceforge.net, bryce1@obviously.com
Subject: Re: Proposed archival read only trigger on rows - prevent history modification
In-Reply-To: <200802212231.58019.xzilla@users.sourceforge.net>
* 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