Re: AW: Postgresql OO Patch - Mailing list pgsql-hackers

From Robert B. Easter
Subject Re: AW: Postgresql OO Patch
Date
Msg-id 00052413555701.22787@comptechnews
Whole thread Raw
In response to AW: Postgresql OO Patch  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
List pgsql-hackers
On Wed, 24 May 2000, Zeugswetter Andreas SB wrote:
> > One more time for the <general> mailing list...
> > 
> > Hands up if you have objections to the patch I recently submitted for
> > postgresql. It fixes the long standing bit-rot / bug  that DELETE and
> > UPDATE don't work on inheritance hierarchies, and it adds the ONLY
> > syntax as mentioned in SQL3 and as implemented by Informix. 
> > The downside
> > is it breaks compatibility with the old inheritance syntax. 
> > But there is
> > a backward compatibility mode. I.e. "SELECT * FROM foobar*" becomes
> > "SELECT * FROM foobar", and "SELECT * from foobar" becomes "SELECT *
> > FROM ONLY foobar".
> > 
> > Benefits:
> > *) SQL3 says it.
> 
> Imho this alone more than justifies the patch.
> We should also change our keyword "inherits" to "under".
> 

I don't agree.  UNDER only provides for single inheritance according to spec. 
Making it multiple inherit would break UNDER's basic idea of enabling hierarchy
trees that contain subtables under a single maximal supertable.  Its like a
body that grows by having organs and cells inside it.  INHERIT is like two or
more separate bodies that together, yield an independent offspring.  UNDER and
INHERIT can coexist and be used together.

CREATE TABLE bike (
);
CREATE TABLE motorbike UNDER bike (
) INHERITS (pistonengine);
CREATE table harley (
) UNDER motorbike;


CREATE engine (
);
CREATE TABLE pistonengine UNDER engine (
)
CREATE TABLE jetengine UNDER engine (
);

Stuff like that.  

CREATE motorbike (
) INHERITS (bike, motor);
is ok too.  But the meaning is different than above.  It creates an independent
child table that is not contained under either parent so that the parents can
be dropped.  You use UNDER when the child/subtabe to share the exact same
physical PRIMARY KEY of the SUPERTABLE.  In inherit, the child inherits a
composite key from the parents, but that key is new physically, not the same
physically as any parents.

I just think that since UNDER is limited by the spec, (and there is a
difference anyway), that INHERITS stands on its own and can be used with UNDER
to pull attributes into the tree from another tree/table, linking separate
trees together in an nondependent way.

> Andreas
-- 
Robert B. Easter
reaster@comptechnews.com


pgsql-hackers by date:

Previous
From: "Robert B. Easter"
Date:
Subject: Re: Fwd: Re: SQL3 UNDER
Next
From: Peter Eisentraut
Date:
Subject: Re: Serious problem within authentication subsystem in 7.0