Re: [SQL] Relation in tables

2005-02-17 Thread lucas
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 column

Re: UPDATE TRIGGER on view WAS: Re: [SQL] Relation in tables

2005-02-16 Thread PFC
And all this time I thought that you couldn't write to a view. You can't. But you can make it seem so you can. You can create an ON UPDATE/INSERT trigger on a view which intercepts the UPDATE/INSERT to the view (which would otherwise fail) and do whatever you want with it, includi

Re: UPDATE TRIGGER on view WAS: Re: [SQL] Relation in tables

2005-02-16 Thread Tom Lane
PFC <[EMAIL PROTECTED]> writes: > You can create an ON UPDATE/INSERT trigger on a view which intercepts the > UPDATE/INSERT to the view (which would otherwise fail) and do whatever you > want with it, including doing the operation on the real table. This might work for INSERT but I really doub

UPDATE TRIGGER on view WAS: Re: [SQL] Relation in tables

2005-02-16 Thread Keith Worthington
On Wed, 16 Feb 2005 19:56:25 +0100, PFC wrote > [snip] Use UPDATE triggers on the > views, which in fact write to the products table [snip] You can DO that!?! Are you saying that a client can DELETE or INSERT or UPDATE a view and through a trigger you can make this happen? Way cool. Can you p

Re: [SQL] Relation in tables

2005-02-16 Thread PFC
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

Re: [SQL] Relation in tables

2005-02-16 Thread KÖPFERL Robert
mailto:[EMAIL PROTECTED] > 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 th

[SQL] Relation in tables

2005-02-16 Thread lucas
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