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

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

Reply via email to