Inheritance and such

From: John Hughes <johnh(at)wetleads(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Inheritance and such
Date: 2005-04-01 15:51:25
Message-ID: 200504010951.25373.johnh@wetleads.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi everyone,

I ran into a brick wall when I realized that inheritance in postgres isnt
really there...

Here's a description of the relevant part of my schema.

CREATE TABLE base (
id serial not null primary key,
<some base columns>
);

CREATE TABLE specialized (
<some specialized columns>
) INHERITS base;

CREATE TABLE specialized2 (
<some specialized columns>
) INHERITS base;

CREATE TABLE events (
id serial not null primary key,
baseid int references base(id)
<some other columns>
);

This does not work if I load a bunch of records into specialized and then try
to refer to the id's through the event's table because Postgres doesn't do
N-table indexes where N is greater than 1 :-P

This whole part of my schema, if it worked, would be so incredibly useful, as
I would be able to add as many specialized tables as needed, and still use
the same sql to create events for them, and access their base table's data,
etc.

So I have 3 questions: Is any work being done currently to fix our
implementation of inheritance? How much work would it take to do this? and
lastly, how can I implement my schema to do something similar, emulated, or
otherwise that will work with postgres as it is now?

Thanks,

John Hughes
Wetleads.com

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chandra Sekhar Surapaneni 2005-04-01 15:54:09 Re: Help with converting hexadecimal to decimal
Previous Message Scott Marlowe 2005-04-01 15:43:38 Re: importance of bgwriter_percent