Inheritance question - Mailing list pgsql-novice

From Joanne Formoso
Subject Inheritance question
Date
Msg-id 20030611071158.10250.qmail@web40607.mail.yahoo.com
Whole thread Raw
In response to Re: Converting IBM DB2 TRIGGERs to PostgreSQL  (Josh Berkus <josh@agliodbs.com>)
List 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

pgsql-novice by date:

Previous
From: Josh Berkus
Date:
Subject: Re: Converting IBM DB2 TRIGGERs to PostgreSQL
Next
From: "Rigmor Ukuhe"
Date:
Subject: Hints to query parser about indexes