Re: SQL3 UNDER
От | Hannu Krosing |
---|---|
Тема | Re: SQL3 UNDER |
Дата | |
Msg-id | 392AAE50.EA91BF72@tm.ee обсуждение исходный текст |
Ответ на | SQL3 UNDER (Chris Bitmead <chris@bitmead.com>) |
Список | pgsql-hackers |
"Robert B. Easter" wrote: > > On Tue, 23 May 2000, Chris Bitmead wrote: > > Maybe it would help if you have two examples. One that only uses UNDER, > > and one that only uses INHERITS, and explain how one or the other can > > work differently. > > Which one (or both) that you use depends on the relationship the two entities > have. If you need multiple inheritance, your choice is clear: INHERITS. UNDER > will not do multiple inheritance. > UNDER is the choice when the idea is of EXTENDing a class into more > specific types of subclasses. INHERIT is the choice when the idea is like > parent and child or olddesign and newdesign where olddesign may disappear > without any problem. > > What follows are some rough examples. There could be some errors. I'd like to > see someone elses examples too. I know there are possibilities for very good > examples. > > CREATE TABLE powersource ( > ); > CREATE TABLE nuclearpowersource ( > ) UNDER powersource; > CREATE fissionpowersource ( > ) UNDER nuclearpowersource; > CREATE fusionpowersource ( > ) UNDER nuclearpowersource; This is what INHERITS currently is meant for. > CREATE TABLE machine ( > ); > CREATE TABLE poweredmachine ( > ) INHERITS(powersource) UNDER machine ; Why not just CREATE TABLE poweredmachine ( machine_powersource powersource) UNDER machine ; This should probably allow to insert any powersource as machine_powersource. ------- Hannu
В списке pgsql-hackers по дате отправления: