Re: [HACKERS] inheritance

From: Hannu Krosing <hannu(at)trust(dot)ee>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chris Bitmead <chris(at)tech(dot)com(dot)au>, pgsql-hackers(at)postgreSQL(dot)org, pgsql-sql(at)postgreSQL(dot)org, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [HACKERS] inheritance
Date: 1999-07-21 16:26:00
Message-ID: 3795F498.9057301F@trust.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers pgsql-sql

Tom Lane wrote:
>
> Chris Bitmead <chris(at)tech(dot)com(dot)au> writes:
> > To me this is a much better idea. In any proper OO application you would
> > be using the "*" in postgres 99% of the time - that being the whole
> > point of OO.

And considering that the Informix OO is probably really
Illustra/Postgres OO,
this is most likely what PostgreSQL was meant to do in the first place.

> > Does any consideration want to be given to making the same
> > change while there's not too many people using the inheritance feature?
>
> What makes you think there's "not too many people" using inheritance?

The poor shape the PostgreSQL inheriatnce (and OO in general) is in ?

> Furthermore, if we did that it would break the code of people who
> *didn't* think they were using inheritance, except as a means of
> copying table definitions (which I do a lot, btw).

This use is to real inheritance as (MS win) cooperative multitasking
is to real multitasking; when you stick to it too much, you will
never have the real one.

> I don't think we can reverse the default on that at this late date.

Maybe we should then need some other construct for _real_ inheritance?
A keyword like EXTENDS or something.
What does ANSI SQL3 say on inheritance?

> > The other thing Informix does is automatically propagate all attributes
> > including indexes, constraints, pretty much everything to sub-classes.
> > Again.. I think this is the right thing. Any thoughts?
>
> I'd be inclined to agree on that, or at least say that we ought to
> provide a simple way of making it happen. But the right semantics
> are not always obvious. For example, if the ancestor has a SERIAL
> column, do the derived tables get their own sequence objects or
> share the ancestor's?

The ancestors sequence of course (ain't I smart <grin> ;)

> Does your answer change if the serial column
> was created "by hand" with a "DEFAULT nextval('some_sequence')" clause?

It should not, else the column would not be _relly_ inherited.

And as we do not have any way change any constraits/defaults after table
creation this problem could be postponed to some later date.

btw, is ALTER TABLE ADD/DROP CONSTRAINT, and changing column defaults
planned for 6.6 ?

OTOH, I'm not sure if DROP TABLE should also drop all inherited tables
too?
My guess is that it should by default (disabled by ONLY ?) - what does
Informix do?

> I suspect that any way we jump on this sort of question will be wrong
> for some apps, so it should be possible to suppress system copying of
> attributes...

maybe we should have a TEMPLATE in addition to INHERITS ?

>
> regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guy Fraser 1999-07-21 16:48:40 How can I do an UPDATE OR CREATE ?
Previous Message Kane Tao 1999-07-21 15:32:37 Re: [GENERAL] Re: [HACKERS] inheritance

Browse pgsql-hackers by date

  From Date Subject
Next Message Louis Bertrand 1999-07-21 17:10:40 Re: [HACKERS] Bug tracking
Previous Message Vince Vielhaber 1999-07-21 16:25:36 Re: [HACKERS] Bug tracking

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 1999-07-21 17:20:09 Re: [SQL] bad select performance fixed by forbidding hash joins
Previous Message George Young 1999-07-21 15:07:10 Re: [SQL] bad select performance fixed by forbidding hash joins