Inheritance question

Поиск
Список
Период
Сортировка
От Joanne Formoso
Тема Inheritance question
Дата
Msg-id 20030611071158.10250.qmail@web40607.mail.yahoo.com
обсуждение исходный текст
Ответ на Re: Converting IBM DB2 TRIGGERs to PostgreSQL  (Josh Berkus <josh@agliodbs.com>)
Список 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 по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: Converting IBM DB2 TRIGGERs to PostgreSQL
Следующее
От: "Rigmor Ukuhe"
Дата:
Сообщение: Hints to query parser about indexes