pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: BOUCHPAN-LERUST-JUERY Lionel <bouchpan@ie2.u-psud.fr>
To: pgsql-sql@postgresql.org
Subject: General ISA and Foreign Key
Date: Mon, 7 May 2001 20:46:32 +0200
Message-ID: <20010507204632.A24888@pc48.ie2.u-psud.fr> (raw)

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




view thread (3+ messages)  latest in thread

Message-ID: <20010507204632.A24888@pc48.ie2.u-psud.fr>
Permalink:  ../20010507204632.A24888@pc48.ie2.u-psud.fr/
Also on:    postgresql.org/message-id/20010507204632.A24888@pc48.ie2.u-psud.fr

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: bouchpan@ie2.u-psud.fr
  Subject: Re: General ISA and Foreign Key
  In-Reply-To: <20010507204632.A24888@pc48.ie2.u-psud.fr>
  References: <20010507204632.A24888@pc48.ie2.u-psud.fr>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox