Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id EE7032E0330 for ; Tue, 12 Feb 2008 04:29:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 65972-08 for ; Tue, 12 Feb 2008 04:29:35 -0400 (AST) Received: from outP.internet-mail-service.net (outP.internet-mail-service.net [216.240.47.239]) by postgresql.org (Postfix) with ESMTP id 419C92E010C for ; Tue, 12 Feb 2008 04:29:47 -0400 (AST) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Tue, 12 Feb 2008 00:29:45 -0800 X-Client-Authorized: MaGic Cook1e Received: from [192.168.1.109] (adsl-71-135-191-42.dsl.pltn13.pacbell.net [71.135.191.42]) by idiom.com (Postfix) with ESMTP id C579C1271A1 for ; Tue, 12 Feb 2008 00:29:44 -0800 (PST) Message-ID: <47B15928.40501@obviously.com> Date: Tue, 12 Feb 2008 00:30:32 -0800 From: Bryce Nesbitt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.11) Gecko/20070803 SUSE/1.1.7-0.1 SeaMonkey/1.1.7 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: Proposed archival read only trigger on rows - prevent history modification References: <771732.23057.qm@web54301.mail.re2.yahoo.com> <47B1580A.7050703@obviously.com> In-Reply-To: <47B1580A.7050703@obviously.com> Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.896 tagged_above=0 required=5 tests=AWL=-0.563, BAYES_50=0.001, HTML_MESSAGE=0.001, MIME_HTML_ONLY=1.457 X-Spam-Level: X-Archive-Number: 200802/88 X-Sequence-Number: 30179 (because our legacy application, which won't change, is using the underlying tables.  We can't do step #5).

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.
  
    

  

-- 
----
Visit http://www.obviously.com/