Thread: comment on inheritance

comment on inheritance

From
MikeSmialek@KnowledgeDynamics.com
Date:
I am a new user to PG (graduating from Access) and had some problems with
inheritance. I stumbled into the inheritance to-do discussion and would like
to put in my two cents. I apologize if this is not the right place to be
sending this.


It seems PG needs two separate types of inheritance: structural inheritance
and 'is-a' inheritance.

Structural inheritance would help the 'inheritance is a convenience' people.
Structural children would inherit foreign keys and per-field validation.
Structural children would not inherit primary keys, or would allow a primary
key declared on the child to override the parent's primary key, not augment
it. I think structural children should have separate indices (by the same
name if possible) from the parent.

'is-a' children would inherit all constraints and share indices and primary
keys with the parent and any siblings, descendants, etc.

Of course this can all be achieved currently by specifying the parent with
no primary key and adding a primary key to the descendants. But it seems
that making this sort of thing more explicit with 'inherit-struct' and
'inherit-is-a' would clear up a lot of confusion.

Thanks