table inheritance and DB design

From: Alec Swan <aukcioner(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: table inheritance and DB design
Date: 2004-12-03 03:30:55
Message-ID: 20041203033055.59295.qmail@web53410.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greetings.

I am trying to create a database, which allows me to store appointment information. The key here is that I don't know what resources will be associated with an appointment, but they will all have a unique id. So, I want to have an Appointment table, a Resource table and a many-to-many relation let's call it AppRes, which associates an appointment with a resource.

Now, I want to have several tables, say Car and Driver, which INHERIT from the Resource table. I also want AppRes table can enforce a ref. constraint on the Resource table. So, in the future I can add a Room table and be able to associate its records with an appointments via AppRes just by making the Room table inherit from the Resource table.

I like this idea a lot, but I noticed that the current version of postgres only enforces FK constraints on the top-level table Resource, and not on its children. So, I cannot insert a record in a Car table and then reference it from the AppRes table, because postgres throws an error saying that this record does not exist in the Resource table.

So, my first question is when FK constraints will be "fixed" to include children tables?

My second question is if there is a design, which will allow me to add different types of resources (Cars, Drivers, Rooms, etc) and have FK constraints enforced in AppRes table?

Thanks.

Alec


---------------------------------
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search. Learn more.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Berend Tober 2004-12-03 03:32:31 Re: Rules
Previous Message Doug McNaught 2004-12-03 03:22:11 Re: relation does not exist error