Making a foreign key chain - good idea or bad idea?

Поиск
Список
Период
Сортировка
От Frank Joerdens
Тема Making a foreign key chain - good idea or bad idea?
Дата
Msg-id 20010124183049.A8283@rakete.joerdens.de
обсуждение исходный текст
Ответы Re: Making a foreign key chain - good idea or bad idea?
Список pgsql-sql
I just did something which seems to work alright and which makes sense
to me now but which I have a funny feeling about. It may be good
standard practice (and I just don't know about it) or dangerously
foolish or just plain silly: I created a foreign key reference on a
column that is also the primary key for this table as in

create table institute (
id    int4 references index ( id ) PRIMARY KEY,. . .

and then used that column as a reference for a foreign key constraint in
a couple of other tables:

create table boss (
institute_id   int4 references institute ( id ),. . . 

create table staff (
institute_id    int4 references institute ( id ),. . . 

I am not really sure what happens when I delete or modify the id column
in the table at the top of this "chain". Except for this uncertainty I
don't think this scheme would pose a problem, but I may be wrong. Can
anyone enlighten me?

Ta, Frank 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Michael Davis
Дата:
Сообщение: RE: SQL Query Results
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: pl/pgsql Limits