From: | Hannu Krosing <hannu(at)tm(dot)ee> |
---|---|
To: | "Robert B(dot) Easter" <reaster(at)comptechnews(dot)com> |
Cc: | Chris Bitmead <chris(at)bitmead(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: SQL3 UNDER |
Date: | 2000-05-23 16:14:08 |
Message-ID: | 392AAE50.EA91BF72@tm.ee |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | The Hermit Hacker | 2000-05-23 20:36:55 | Ignore, just testing ... |
Previous Message | Kardos, Dr. Andreas | 2000-05-23 15:56:20 | Re: failing over with postgresql |