how to reference polymorphic objects

From: Markus Wagner <wagner(at)imbei(dot)uni-mainz(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: how to reference polymorphic objects
Date: 2003-04-16 07:50:39
Message-ID: 200304160950.39044.wagner@imbei.uni-mainz.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I recently noticed some problems using inheritance in pg.

assume the following data model:

create table Person
(
idx serial primary key,
Name text not null
);

create table Physician
(
expertise text
)
inherits (Person);

create table Programmer
(
skills text
)
inherits (Person);

create table Project
(
idx serial primary key,
Name text not null,
Leader int references Person (idx)
);

-----

Ok, when inserting data into the tables Person, Physician and Programmer, the
primary keys (idx) will be always disjunct, but only if the model above was
created using pgaccess (which inserts some additional sequence stuff).

The other thing is the more serious one:

When inserting data into Projects, you may only insert objects which belong to
the table Person. You may not reference rows from derived tables (Physician,
Programmer).

Some Questions: Can we expect to have all of the benefits of object-oriented
programming in the future? Is there a specification on what features can be
expected from ORDBMS in general?

Thank you very much,
Markus Wagner

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar 2003-04-16 07:55:14 Re: Are we losing momentum?
Previous Message Shridhar Daithankar 2003-04-16 07:20:33 Re: Are we losing momentum?