Inheritance and such - Mailing list pgsql-general

From John Hughes
Subject Inheritance and such
Date
Msg-id 200504010951.25373.johnh@wetleads.com
Whole thread Raw
Responses Re: Inheritance and such  (Stephane Bortzmeyer <bortzmeyer@nic.fr>)
List 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

pgsql-general by date:

Previous
From: "Karl O. Pinc"
Date:
Subject: Best practices for (plpgsql ?) trigger optimization?
Next
From: "Chandra Sekhar Surapaneni"
Date:
Subject: Re: Help with converting hexadecimal to decimal