> > 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 ---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html