Re: Do values have constraints?

From: Bob Badour <bbadour_at_golden.net>
Date: Fri, 5 Sep 2003 22:42:26 -0400
Message-ID: <K%c6b.591$ZH.53962788_at_mantis.golden.net>


"Paul Vernon" <paul.vernon_at_ukk.ibmm.comm> wrote in message news:bjadto$19vm$1_at_gazette.almaden.ibm.com...
> "Bob Badour" <bbadour_at_golden.net> wrote in message
> news:3x36b.549$hG7.51871761_at_mantis.golden.net...
> [snip]
> > > What about foreign key and other database constraints.
> >
> > Ahhh, now we move beyond the realm of relation types to the realm of
> > database types.
> [snip]
> > I think it makes sense to look at a different example and then work
outward.
> > If we have a relvar A with two attributes F and G, we might have a
> > constraint that F < G. This constraint does not affect the type of
either F
> > or G, but it does affect the type of A. Likewise, if F and G were
relation
> > valued attributes, we might have a constraint establishing a foreign key
> > constraint between the relations in those attributes. Again, this
constraint
> > would affect the type of A but not the type of F or G.
> >
> > If we take a step back and observe that A has a foreign key reference
from
> > B, then the foreign key does not affect the type of A or the type of B,
but
> > it does affect the type of the database variable that represents A and
B.
>
> OK, so database constraints alter the type of the database variable.
> Relation constraints alter the type of relation variables (and so the
database
> variable also)
> Attribute constraints alter the type of attributes (and so their relation
variable
> and the database variable also)
>
> Is that correct?

Yes, that is the way I look at it.

> Next is constraint inference on values the only point to all this, or are
there other
> benefits in regarding constraints to be part of declared relation types?

They are part of the type regardless. Consider a hypothetical programming language that conforms to TTM's model of inheritance and polymorphism, and consider two variables where integer is a subtype of rational:

var i integer;
var x rational constraint x = floor(x);

Both variables effectively have the same declared type.

> BTW I'm a looong way from buying all of this, but lets see where it leads.
:-)

In what ways do constraints not affect the type? Received on Sat Sep 06 2003 - 04:42:26 CEST

Original text of this message