Making a foreign key chain - good idea or bad idea? - Mailing list pgsql-sql

From Frank Joerdens
Subject Making a foreign key chain - good idea or bad idea?
Date
Msg-id 20010124183049.A8283@rakete.joerdens.de
Whole thread Raw
Responses Re: Making a foreign key chain - good idea or bad idea?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
List 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 by date:

Previous
From: Michael Davis
Date:
Subject: RE: SQL Query Results
Next
From: Josh Berkus
Date:
Subject: Re: pl/pgsql Limits