Re: inheritance and primary/foreign keys

From: Einar Karttunen <ekarttun(at)cs(dot)Helsinki(dot)FI>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: inheritance and primary/foreign keys
Date: 2001-03-09 07:31:04
Message-ID: Pine.LNX.4.30.0103090919340.26024-100000@melkinpaasi.cs.Helsinki.FI
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 7 Mar 2001, Stephan Szabo wrote:
>
> You cannot safely reference tops of inheritance trees under 7.0 or 7.1 and
> have it reference the trees.
>
Is there anyway to emulate this? I want to have several types of persons
which have varied and common data. How can I implement refences to a
person or a child table of person? Are there any problems with the parent
having a serial column? The index should be unique for all the children
too.

CRETE TABLE person (
id SERIAL,
fname varchar(15),
lname varchar(15),
pwd varchar(8)
);

CREATE TABLE teacher (
uname char(4)
) INHERITS (person);

CREATE TABLE admin (
uname char(8),
type integer
) INHERITS (person);

CREATE TABLE record (
id SERIAL,
pid integer REFERENCES person
);

- Einar Karttunen

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-03-09 08:55:04 Re: Escaping underscores in LIKE
Previous Message will trillich 2001-03-09 07:18:39 Re: explain -> how to optimize?