Received: from rakete.joerdens.de (rakete.joerdens.de [62.104.116.200]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0OHTxq38222 for ; Wed, 24 Jan 2001 12:29:59 -0500 (EST) (envelope-from frank@rakete.joerdens.de) Received: (from frank@localhost) by rakete.joerdens.de (8.9.3/8.9.3) id SAA08570 for pgsql-sql@postgresql.org; Wed, 24 Jan 2001 18:30:50 +0100 Date: Wed, 24 Jan 2001 18:30:50 +0100 From: Frank Joerdens To: pgsql-sql@postgresql.org Subject: Making a foreign key chain - good idea or bad idea? Message-ID: <20010124183049.A8283@rakete.joerdens.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.1.2i X-Subliminal-Message: Use Linux! Use Linux! X-Archive-Number: 200101/331 X-Sequence-Number: 1004 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