Re: Inheritance

From: "Zeugswetter Andreas SB SD" <ZeugswetterA(at)spardat(dot)at>
To: "Curt Sampson" <cjs(at)cynic(dot)net>
Cc: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Greg Copeland" <greg(at)CopelandConsulting(dot)Net>, "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>, "PostgresSQL Hackers Mailing List" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Inheritance
Date: 2002-08-19 09:34:53
Message-ID: 46C15C39FEB2C44BA555E356FBCD6FA4961E4B@m0114.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> > Seems with above you are not able to constrain what qualifies for a
> > supertable row, you would only be able to specify constraints that
> > apply to all it's subtables.
>
> Yes, that's the whole point. If I have a constraint on a table, I think
> it should *never* be possible for that constraint to be violated. If a
> subtable should not have constraint the supertable has, it shouldn't
> inherit from the supertable.

If you want that, you simply need to only create constraints that apply to
all tables in the hierarchy. Note that you *can* do this. It should imho be
the default behavior.

>
> To do otherwise breaks the relational model.
>

That is probably a point of argument. Imho the inheritance feature
is something orthogonal to the relational model. It is something else, and
thus cannot break the relational model.

>
> > The SQL inheritance is a class/subclass thing. All tables have
> > instances (==rows) that are not (by itself) related. (Even if
> > they happen to share all attribute values with another row of a
> > supertable.) If you want that, then you need to resort to 3NF (or
> > ROWREF's which iirc is another SQL99 feature).
>
> As I understand it, SQL99 has the restriction that a row with the same
> primary key appearing in a supertable and/or any of its subtables must
> be the result of a single INSERT statement. Thus, SQL99 doesn't allow
> what you're saying, if I understand what you're saying. (I'm not sure
> that I do.)

I was not talking about primary key, not all tables have a primary key.
If the supertable has a PK, then of course an exact match of columns is not
possible in supertable/subtable rows.

> Am I to take it that you think the inheritance should be inheritance
> of type information only? That is, if I have supertable A and
> subtable A', inserting a row into A' does not make a row appear in
> A? If so, I've got not real problem with that at present, but it's
> not what postgres currently does, nor would it conform to SQL99.

No, not at all. All I am saying is that I want to be able to create a
constraint that only applies to the supertable rows, and not the
subtable rows. I would *not* want this as default behavior when creating a
constraint though.

Andreas

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-08-19 13:46:50 Re: Function result cacheing - any comments?
Previous Message Manfred Koizar 2002-08-19 09:28:01 Page type