Inheritance and primary key

From: Guillaume Rousse <Guillaume(dot)Rousse(at)univ-reunion(dot)fr>
To: pgsql-general(at)postgreSQL(dot)org
Subject: Inheritance and primary key
Date: 2000-01-10 13:05:21
Message-ID: 00011017381300.00654@agathe
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


I use a super-class S (virtual, in fact) ans three inheritated classes S1, S2
and S3. i wish to have a primary key for all these classes, in order to use
queries as : SELECT * FROM S* WHERE s.id=x
I use a serial ID field for S as a primary key. Sequencing is OK, as any
insertion in any of the four classes increments the counter. But uniqueness
constraint is lost, as i can have duplicated values between differents classes.
And even in the same class for the inherited ones, as primary key propertie of
ID column is lost through inheritance. And i can't specify a unique constraint
on this column, as it is not present in the class definition.
How to solve this problem ?

--
Guillaume Rousse
*******************************************
Iremia -Universit de la Runion
15 avenue Ren Cassin, BP 7151
97715 Saint Denis, messagerie cedex 9
Tel:0262938287 Fax:0262938260 ICQ:10756815
Mail:Guillaume(dot)Rousse(at)univ-reunion(dot)fr

BRIDGEKEEPER: What... is the air-speed velocity of an unladen swallow?
ARTHUR: What do you mean? An African or European swallow?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dan Boutin 2000-01-10 13:35:26 NTWS Demo?
Previous Message Benkő Attila 2000-01-10 12:52:21 Support for national characters - Hungarian