From: | Joanne Formoso <joanneformoso(at)yahoo(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Inheritance question |
Date: | 2003-06-11 07:11:58 |
Message-ID: | 20030611071158.10250.qmail@web40607.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I'm completely novice when it comes to databases so
please bear with me.
The database application I'm doing has something to do
with putting personal records in the database. I
separated the personal information and the
professional information by creating two different
tables in the database. The two tables are linked
through an P_ID foreign key.
My problem is I've added two constraints: namely
ALTER TABLE professional_data add constraint (test1)
foreign key (prof_id) references personal_data (p_id)
on update cascade;
and
ALTER TABLE professional_data add constraint (test2)
foreign key (prof_id) references personal_data (p_id)
on delete cascade;
When I change the p_id in the personal_data table the
prof_id is also changed in the professional_data
table. But when I try to delete a record that in the
personal_data table the record can't be deleted.
Postgresql gives this errors:
test1 referential integrity violation - key in
personal_data still referenced from professional_data
Is there anyway for me to combine both the update
cascade and delete cascade in one foreign key
constraint?
Thanks,
Joanne
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Rigmor Ukuhe | 2003-06-11 08:19:39 | Hints to query parser about indexes |
Previous Message | Josh Berkus | 2003-06-11 05:25:21 | Re: Converting IBM DB2 TRIGGERs to PostgreSQL |