X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 08C618B9B5E for ; Thu, 17 Feb 2005 10:57:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 54106-10 for ; Thu, 17 Feb 2005 10:57:28 +0000 (GMT) Received: from iracema.dnscenter.com.br (iracema.dnscenter.com.br [67.15.80.70]) by svr1.postgresql.org (Postfix) with ESMTP id 4FCEF8B9B3D for ; Thu, 17 Feb 2005 10:57:29 +0000 (GMT) Received: from cpanel by iracema.dnscenter.com.br with local (Exim 4.44) id 1D1jLZ-0001GZ-E7; Thu, 17 Feb 2005 07:57:25 -0300 Received: from 200.158.187.2 ([200.158.187.2]) by www.presserv.org (Horde) with HTTP for ; Thu, 17 Feb 2005 07:57:25 -0300 Message-ID: <20050217075725.q7hlx6iv076okogk@www.presserv.org> Date: Thu, 17 Feb 2005 07:57:25 -0300 From: lucas@presserv.org To: PFC Cc: pgsql-sql@postgresql.org Subject: Re: Relation in tables References: <20050216134301.5myrfpr3ck6bmswc@www.presserv.org> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit User-Agent: Internet Messaging Program (IMP) H3 (4.0) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - iracema.dnscenter.com.br X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [32001 502] / [47 12] X-AntiAbuse: Sender Address Domain - presserv.org X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.204 tagged_above=0 required=5 tests=NO_REAL_NAME, RCVD_IN_NJABL_PROXY X-Spam-Level: * X-Archive-Number: 200502/188 X-Sequence-Number: 20299 > > Use a view per department, which show/hide the columns according to your > liking. Give each department a schema and put everything related to it > inside for cleanliness. Use UPDATE triggers on the views, which in fact > write to the products table, so that the departments can only update the > columns you like. You can even make some columns readable but not > writeable, by raising an exception if a modification is attempted on that > column. > > If you want to reuse your code between departments, you will want all the > views to have the same columns, so make them return NULL for the fields > that they cannot see. > > Finally don't forget to make the products table inaccessible the > departments. > Okay, I will use Triggers to manage the insert and update table and viewers to select records, but need I use more than one table (with inherits)? Or I just use product table with the ALL departaments coluns and check the perms into Triggers and Viewers??? Thanks