General ISA and Foreign Key - Mailing list pgsql-sql

From BOUCHPAN-LERUST-JUERY Lionel
Subject General ISA and Foreign Key
Date
Msg-id 20010507204632.A24888@pc48.ie2.u-psud.fr
Whole thread Raw
Responses Re: General ISA and Foreign Key
List pgsql-sql
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



pgsql-sql by date:

Previous
From: "tjk@tksoft.com"
Date:
Subject: Re: Re: Need help with search-and-replace
Next
From: Peter Eisentraut
Date:
Subject: Re: RI permission problem