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