From: | Prabu Subroto <prabu_subroto(at)yahoo(dot)com> |
---|---|
To: | Postgres General Milis <pgsql-general(at)postgresql(dot)org> |
Subject: | one view for 2 different tables |
Date: | 2004-08-02 17:30:33 |
Message-ID: | 20040802173033.11149.qmail@web41804.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Dear my friends...
I am developing a database application with postgres
7.2.x, qt on SuSE 9.1 . I am in a situation where I
have to use QDataTable and I have to use QSqlCursor
that support only 1 table manipulation ( QSqlCursor *
cursor = QSqlCursor("viewpatrix", true, db); ).
So, as a strategy I make a view. with this view I hope
I can work with more than 1 table at a time.
kv=# create view viewpatrix as select customer.custid,
customerdescription.descr
iption, customer.firstname,
customer.lastname from customer, customerdescription
where
customer.custid=customerdescription.custid;
but I have problems if I want to make data update and
data insertion from the QDataTable because I don't
know how the rule should be.
kv=# create rule viewpatrixcustdesc as on update to
viewpatrix do instead update customerdescription set
description=new.description where custid=old.custid;
CREATE RULE
kv=#
OK, it works if the user wants to update the data in
table "customerdescription".
should I simply create another rule like this:
kv=# create rule viewpatrixcust as on update to
viewpatrix do instead update customer set
firstname=new.firstname, lastname=new.lastname where
custid=old.custid;
CREATE RULE
kv=#
But how to make that the user can I also update the
data in the table "customer" (customer.firstname and
customer.lastname).
Is it possible to create one view but from
updating/inserting the data in the coresponded rule
than the records in more then 2 tables are also
updated/inserted?
Thank you very much for your help.
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail
From | Date | Subject | |
---|---|---|---|
Next Message | D. Richard Hipp | 2004-08-02 19:11:24 | Re: PostgreSQL, GnuCash |
Previous Message | Simon Windsor | 2004-08-02 17:21:17 | Re: psql and md5 |