> > > 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.
>
> So what you're saying is that constraints shouldn't be inherited?
No. I even said that inheriting should be the default.
> > > 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.
>
> So then constraints must be inherited. The relational model, if I
> am not incorrect here, says that, given a table definition such as
> this:
>
> CREATE TABLE my_table (
> my_key int PRIMARY KEY,
> my_value text UNIQUE,
> my_other_value int CHECK (my_other_value > 0)
> )
A local constraint should be made obvious from looking at the schema,
a possible syntax (probably both ugly :-):
CHECK my_table ONLY (my_other_value > 0)
or
CHECK LOCAL (my_other_value > 0)
>
> You will never, ever, when selecting from this table, have
> returned to you
>
> 1. two rows with the same value of my_key but different values
> for the other columns,
>
> 2. two rows with the same value of my_value but different values
> for the other columns, or
>
> 3. a row in which the value of my_other_value is not
> greater than zero.
>
Well, that is where I do not think this is flexible enough, and keep in mind
that all triggers and rules would then also need such restrictions.
> I would strongly object to that.
Regardless whether your objection is *strong* or not :-)
If you don't like the feature (to add a local constraint), don't use it.
(Remember you are talking about removing an implemented feature)
Andreas