Re: [QUESTIONS] inheritance questions

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: Olivier(dot)Caron(at)iut-gtr(dot)univ-artois(dot)fr (Olivier Caron)
Cc: pgsql-questions(at)postgreSQL(dot)org, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [QUESTIONS] inheritance questions
Date: 1998-05-07 10:38:38
Message-ID: 199805071138.MAA05000@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Olivier Caron wrote:
>in the user's guide (chapter _ inheritance), i see :
>-----------------------------------------------------------
>select * from cities *
>
>here the * after cities indicates that the query should be run over cities
>and all classes below cities in the inheritance hierarchy.
>Many of the commands that we have already discussed -- select, update
>and delete -- support this * notation, as do others, like alter
>-----------------------------------------------------------
>
>i don't succedeed in to execute update or delete with this * notation,

The ramifications of inheritance are not well thought out in PostgreSQL.

Consider:

cities -----+---- capital_cities ----- megacities
¦
+---- regional_centres
¦
+---- small_towns

At the moment, a subclass inherits columns and _some_ constraints from
its parents - it inherits check constraints but not primary key constraints.
I don't know what behaviour is planned for foreign key constraints.
It is possible, with multiple inheritance, to inherit mutually-inconsistent
check constraints but there is no way to undefine or redefine inherited
constraints.

You can do `select * from cities *', but you cannot do an insert, delete
or update. In other words, the inheritance tree as a whole is regarded as
a read-only entity.

The inability to do insert seems reasonable, because there
would not be any safe way of knowing which table in the inheritance
tree was intended. However, update and delete could be expected to
work. I suspect that no-one ever asked for the facility!

I have previously suggested some syntax for specifying the inheritance
of constraints more precisely. It looks as if there should also be a
means of saying whether a descendant class should be included in
operations on multiple rows - I don't think it should be a facility that
operates automatically.

Is any of the developers an expert on the inheritance features? or is
this something that no-one has yet taken up?

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
PGP key from public servers; key ID 32B8FAA1
========================================
"If it is possible, as much as it depends on you, live
peaceably with all men." Romans 12:18

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 1998-05-07 11:04:04 Decicision needed for connect statement
Previous Message Andreas Zeugswetter 1998-05-07 07:41:11 AW: AW: [HACKERS] Re: [QUESTIONS] groups of users