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 E24128BA320 for ; Wed, 16 Feb 2005 18:43:48 +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 32845-07 for ; Wed, 16 Feb 2005 18:43:16 +0000 (GMT) Received: from mx-00.sil.at (mx-00.sil.at [62.116.68.196]) by svr1.postgresql.org (Postfix) with ESMTP id C852A8B9E52 for ; Wed, 16 Feb 2005 18:33:55 +0000 (GMT) Received: (qmail-ldap/ctrl 94919 invoked from network); 16 Feb 2005 18:33:50 -0000 Received: from unknown (HELO jupiter.sonorys.at) ([213.235.243.42]) (envelope-sender ) by mx-00.sil.at (qmail-ldap-1.03) with SMTP for ; 16 Feb 2005 18:33:50 -0000 Received: from neptun.sonorys.at (neptun.sonorys.at [172.24.1.17]) by jupiter.sonorys.at (8.11.7+Sun/8.11.7) with ESMTP id j1GIYGs19325 for ; Wed, 16 Feb 2005 19:34:16 +0100 (MET) Received: by neptun.sonorys.at with Internet Mail Service (5.5.2653.19) id ; Wed, 16 Feb 2005 19:33:55 +0100 Message-ID: From: =?ISO-8859-1?Q?K=D6PFERL_Robert?= To: pgsql-sql@postgresql.org Subject: Re: Relation in tables Date: Wed, 16 Feb 2005 19:33:55 +0100 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="ISO-8859-1" X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200502/167 X-Sequence-Number: 20278 You may possibly solve the problem with the inheritted tables with the RULE-System of pgsql. But this seems oversized to me. You could rather create several tables, each with its matching rights/privileges and 'connect' them via an 1:1 relation. The 'real' way such thing is normally done is to write stored procedures which are accessible (Executable) only by those departments that may. If you give these procs SECURITY DEFINER, you can restrict access to the actual tables to only the procedure's owner > -----Original Message----- > From: lucas@presserv.org [mailto:lucas@presserv.org] > Sent: Mittwoch, 16. Februar 2005 17:43 > To: pgsql-sql@postgresql.org > Subject: [SQL] Relation in tables > > > Hello all... > I am starting in Postgresql... > And I have a question: > I am developing a DB system to manage products, but the > products may be > separated by departaments (with its respectives coluns)... Like: > > CREATE TABLE products( > id serial primary key, > desc valchar(100), > ... > ); > > Okay, but the products is typed by "amount departament" and > this departament > should not have access to other coluns like "values, Money, etc...". > The "finances departament" may modify the data into products > table, but this > departament should not have access to coluns like "amounts, etc...". > > I' ve tried to create the products table with INHERITS but > its not right... > look: > > CREATE TABLE prod_amounts ( > amount_min numeric, > amount_cur numeric, > amount_max numeric, > ... > ) INHERITS products; > > CREATE TABLE prod_values ( > buy_value money, > sen_value money, > ... > ) INHERITS products; > > Okay, but the problem is: I can INSERT a prod_amounts normaly > and automaticaly > the products table will be filled, but when i try to modify > the data in > prod_amounts (references in products) there is no data.... > I think its not right ( I am sure :/ ). > How Can I do it??? > How Can I References Between Prod_amounts and Prod_Values > automaticaly? > remembering the Amounts departament may not access the Values > departament data > and the Values departament may not access the amounts data... > And the products > will be registred (typed) in Amount departament.... > > Thanks for all. > > ---------------------------(end of > broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index > scan if your > joining column's datatypes do not match >