Received: from upsn13.u-psud.fr (upsn13.u-psud.fr [193.55.10.113]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f47IkhA33263 for ; Mon, 7 May 2001 14:46:44 -0400 (EDT) (envelope-from bouchpan@ie2.u-psud.fr) Received: from upsn13.u-psud.fr (localhost [127.0.0.1]) by upsn13.u-psud.fr (8.11.1/8.9.0) with ESMTP id f47Imxf25431 for ; Mon, 7 May 2001 20:48:59 +0200 (MET DST) Received: from ie2.u-psud.fr (IDENT:root@pingouin.ie2.u-psud.fr [193.55.28.130]) by upsn13.u-psud.fr (8.11.1/8.9.0) with ESMTP id f47Imwj25427 for ; Mon, 7 May 2001 20:48:59 +0200 (MET DST) Received: from pc48.ie2.u-psud.fr (IDENT:root@pc48 [193.55.28.208]) by ie2.u-psud.fr (8.9.3/8.8.7) with ESMTP id UAA25500 for ; Mon, 7 May 2001 20:46:33 +0200 Received: (from bouchpan@localhost) by pc48.ie2.u-psud.fr (8.9.3/8.9.3) id UAA24898 for pgsql-sql@postgresql.org; Mon, 7 May 2001 20:46:33 +0200 Date: Mon, 7 May 2001 20:46:32 +0200 From: BOUCHPAN-LERUST-JUERY Lionel To: pgsql-sql@postgresql.org Subject: General ISA and Foreign Key Message-ID: <20010507204632.A24888@pc48.ie2.u-psud.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i X-Archive-Number: 200105/50 X-Sequence-Number: 2851 I have a problem concerning an University assignment in SQL. I am running PostgreSQL. Below part of the E/R diagram in ASCII art. ( #VisaExploitation ) | -------- //\\ -------- | | // \\ | | | 1 |<------------// \\---------| copy | | | \\ from// | | -------- \\ // -------- | \\// | | | /\ (#copy ) /ISA\ ------ | | | | ---- ---- | | | | | 2 | | 3 | ----- ----- 1: Film 2: SpecialFilm 3: HistoricalFilm 2 and 3 inherits from film : In SQL I have the following tables CREATE TABLE film( VisaExploitation INTEGER NOT NULL, DureeTournage INTEGER NOT NULL, Titre VARCHAR( 50 ), PRIMARY KEY ( VisaExploitation ) ); CREATE TABLE filmHistorique( NbCostume INTEGER ) INHERITS ( film ); create table filmDocumentaire( ) INHERITS ( film ); I have a weak entity: CREATE TABLE copie( NumCopie INTEGER NOT NULL, VisaExploitation INTEGER NOT NULL, PRIMARY KEY( VisaExploitation, NumCopie ), FOREIGN KEY( VisaExploitation ) REFERENCES film ON DELETE CASCADE ); The problem is I have to be able to have the constraint on both 2 and 3 and I can't figure how to implement this. Thanking you in Advance, Lionel