pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: lucas@presserv.org
To: pgsql-sql@postgresql.org
Subject: Relation in tables
Date: Wed, 16 Feb 2005 13:43:01 -0300
Message-ID: <20050216134301.5myrfpr3ck6bmswc@www.presserv.org> (raw)

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.



view thread (4+ messages)  latest in thread

Message-ID: <20050216134301.5myrfpr3ck6bmswc@www.presserv.org>
Permalink:  ../20050216134301.5myrfpr3ck6bmswc@www.presserv.org/
Also on:    postgresql.org/message-id/20050216134301.5myrfpr3ck6bmswc@www.presserv.org

 · 

reply

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: lucas@presserv.org
  Subject: Re: Relation in tables
  In-Reply-To: <20050216134301.5myrfpr3ck6bmswc@www.presserv.org>

* 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