table inheritance and DB design

Поиск
Список
Период
Сортировка
От Alec Swan
Тема table inheritance and DB design
Дата
Msg-id 20041203033055.59295.qmail@web53410.mail.yahoo.com
обсуждение исходный текст
Ответы Re: table inheritance and DB design
Список 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.

В списке pgsql-general по дате отправления:

Предыдущее
От: Doug McNaught
Дата:
Сообщение: Re: relation does not exist error
Следующее
От: "Berend Tober"
Дата:
Сообщение: Re: Rules